Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / logging / logging_impl.h
blob1fc3e76fee061b0f6926612e8a656f5625316f7c
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
7 // Generic class that handles event logging for the cast library.
8 // Logging has three possible optional forms:
9 // 1. Raw data and stats accessible by the application.
10 // 2. Tracing of raw events.
12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_checker.h"
14 #include "media/cast/cast_config.h"
15 #include "media/cast/logging/logging_defines.h"
16 #include "media/cast/logging/logging_raw.h"
18 namespace media {
19 namespace cast {
21 class LoggingImpl {
22 public:
23 LoggingImpl();
24 ~LoggingImpl();
26 // Note: All methods below should be called from the same thread.
28 void InsertFrameEvent(const base::TimeTicks& time_of_event,
29 CastLoggingEvent event, EventMediaType event_media_type,
30 uint32 rtp_timestamp, uint32 frame_id);
32 void InsertCapturedVideoFrameEvent(const base::TimeTicks& time_of_event,
33 uint32 rtp_timestamp,
34 int width,
35 int height);
37 void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
38 CastLoggingEvent event,
39 EventMediaType event_media_type,
40 uint32 rtp_timestamp,
41 uint32 frame_id,
42 int encoded_size,
43 bool key_frame,
44 int target_bitrate,
45 double encoder_cpu_utilization,
46 double idealized_bitrate_utilization);
48 void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
49 CastLoggingEvent event,
50 EventMediaType event_media_type,
51 uint32 rtp_timestamp, uint32 frame_id,
52 base::TimeDelta delay);
54 void InsertSinglePacketEvent(const base::TimeTicks& time_of_event,
55 CastLoggingEvent event,
56 EventMediaType event_media_type,
57 const Packet& packet);
59 void InsertPacketListEvent(const base::TimeTicks& time_of_event,
60 CastLoggingEvent event,
61 EventMediaType event_media_type,
62 const PacketList& packets);
64 void InsertPacketEvent(const base::TimeTicks& time_of_event,
65 CastLoggingEvent event,
66 EventMediaType event_media_type, uint32 rtp_timestamp,
67 uint32 frame_id, uint16 packet_id,
68 uint16 max_packet_id, size_t size);
70 // Delegates to |LoggingRaw::AddRawEventSubscriber()|.
71 void AddRawEventSubscriber(RawEventSubscriber* subscriber);
73 // Delegates to |LoggingRaw::RemoveRawEventSubscriber()|.
74 void RemoveRawEventSubscriber(RawEventSubscriber* subscriber);
76 private:
77 base::ThreadChecker thread_checker_;
78 LoggingRaw raw_;
80 DISALLOW_COPY_AND_ASSIGN(LoggingImpl);
83 } // namespace cast
84 } // namespace media
86 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_