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