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_ 6 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. 11 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" 17 18 namespace media { 19 namespace cast { 20 21 class LoggingImpl { 22 public: 23 LoggingImpl(); 24 ~LoggingImpl(); 25 26 // Note: All methods below should be called from the same thread. 27 28 void InsertFrameEvent(const base::TimeTicks& time_of_event, 29 CastLoggingEvent event, EventMediaType event_media_type, 30 uint32 rtp_timestamp, uint32 frame_id); 31 32 void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event, 33 CastLoggingEvent event, 34 EventMediaType event_media_type, 35 uint32 rtp_timestamp, uint32 frame_id, 36 int frame_size, bool key_frame, 37 int target_bitrate); 38 39 void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event, 40 CastLoggingEvent event, 41 EventMediaType event_media_type, 42 uint32 rtp_timestamp, uint32 frame_id, 43 base::TimeDelta delay); 44 45 void InsertSinglePacketEvent(const base::TimeTicks& time_of_event, 46 CastLoggingEvent event, 47 EventMediaType event_media_type, 48 const Packet& packet); 49 50 void InsertPacketListEvent(const base::TimeTicks& time_of_event, 51 CastLoggingEvent event, 52 EventMediaType event_media_type, 53 const PacketList& packets); 54 55 void InsertPacketEvent(const base::TimeTicks& time_of_event, 56 CastLoggingEvent event, 57 EventMediaType event_media_type, uint32 rtp_timestamp, 58 uint32 frame_id, uint16 packet_id, 59 uint16 max_packet_id, size_t size); 60 61 // Delegates to |LoggingRaw::AddRawEventSubscriber()|. 62 void AddRawEventSubscriber(RawEventSubscriber* subscriber); 63 64 // Delegates to |LoggingRaw::RemoveRawEventSubscriber()|. 65 void RemoveRawEventSubscriber(RawEventSubscriber* subscriber); 66 67 private: 68 base::ThreadChecker thread_checker_; 69 LoggingRaw raw_; 70 71 DISALLOW_COPY_AND_ASSIGN(LoggingImpl); 72 }; 73 74 } // namespace cast 75 } // namespace media 76 77 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ 78