| 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 | 4 |
| 5 #ifndef MEDIA_CAST_LOGGING_LOGGING_RAW_H_ | 5 #ifndef MEDIA_CAST_LOGGING_LOGGING_RAW_H_ |
| 6 #define MEDIA_CAST_LOGGING_LOGGING_RAW_H_ | 6 #define MEDIA_CAST_LOGGING_LOGGING_RAW_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "base/time/tick_clock.h" | 16 #include "base/time/tick_clock.h" |
| 17 #include "media/cast/logging/logging_defines.h" | 17 #include "media/cast/logging/logging_defines.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 namespace cast { | 20 namespace cast { |
| 21 | 21 |
| 22 // This class is not thread safe, and should only be called from the main | 22 // This class is not thread safe, and should only be called from the main |
| 23 // thread. | 23 // thread. |
| 24 class LoggingRaw : public base::NonThreadSafe, | 24 class LoggingRaw : public base::NonThreadSafe, |
| 25 public base::SupportsWeakPtr<LoggingRaw> { | 25 public base::SupportsWeakPtr<LoggingRaw> { |
| 26 public: | 26 public: |
| 27 LoggingRaw(); | 27 explicit LoggingRaw(bool is_sender); |
| 28 ~LoggingRaw(); | 28 ~LoggingRaw(); |
| 29 | 29 |
| 30 // Inform of new event: three types of events: frame, packets and generic. | 30 // Inform of new event: three types of events: frame, packets and generic. |
| 31 // Frame events can be inserted with different parameters. | 31 // Frame events can be inserted with different parameters. |
| 32 void InsertFrameEvent(const base::TimeTicks& time_of_event, | 32 void InsertFrameEvent(const base::TimeTicks& time_of_event, |
| 33 CastLoggingEvent event, | 33 CastLoggingEvent event, |
| 34 uint32 rtp_timestamp, | 34 uint32 rtp_timestamp, |
| 35 uint32 frame_id); | 35 uint32 frame_id); |
| 36 | 36 |
| 37 // Size - Inserting the size implies that this is an encoded frame. | 37 // Size - Inserting the size implies that this is an encoded frame. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 59 | 59 |
| 60 void InsertGenericEvent(const base::TimeTicks& time_of_event, | 60 void InsertGenericEvent(const base::TimeTicks& time_of_event, |
| 61 CastLoggingEvent event, | 61 CastLoggingEvent event, |
| 62 int value); | 62 int value); |
| 63 | 63 |
| 64 // Get raw log data. | 64 // Get raw log data. |
| 65 FrameRawMap GetFrameData() const; | 65 FrameRawMap GetFrameData() const; |
| 66 PacketRawMap GetPacketData() const; | 66 PacketRawMap GetPacketData() const; |
| 67 GenericRawMap GetGenericData() const; | 67 GenericRawMap GetGenericData() const; |
| 68 | 68 |
| 69 AudioRtcpRawMap GetAndResetAudioRtcpData(); |
| 70 VideoRtcpRawMap GetAndResetVideoRtcpData(); |
| 69 | 71 |
| 70 // Reset all log data. | 72 // Reset all log data; except the Rtcp copies. |
| 71 void Reset(); | 73 void Reset(); |
| 72 | 74 |
| 73 private: | 75 private: |
| 74 void InsertBaseFrameEvent(const base::TimeTicks& time_of_event, | 76 void InsertBaseFrameEvent(const base::TimeTicks& time_of_event, |
| 75 CastLoggingEvent event, | 77 CastLoggingEvent event, |
| 76 uint32 frame_id, | 78 uint32 frame_id, |
| 77 uint32 rtp_timestamp); | 79 uint32 rtp_timestamp); |
| 78 | 80 |
| 81 void InsertRtcpFrameEvent(const base::TimeTicks& time_of_event, |
| 82 CastLoggingEvent event, |
| 83 uint32 rtp_timestamp, |
| 84 base::TimeDelta delay); |
| 85 |
| 86 const bool is_sender_; |
| 79 FrameRawMap frame_map_; | 87 FrameRawMap frame_map_; |
| 80 PacketRawMap packet_map_; | 88 PacketRawMap packet_map_; |
| 81 GenericRawMap generic_map_; | 89 GenericRawMap generic_map_; |
| 90 AudioRtcpRawMap audio_rtcp_map_; |
| 91 VideoRtcpRawMap video_rtcp_map_; |
| 92 |
| 82 base::WeakPtrFactory<LoggingRaw> weak_factory_; | 93 base::WeakPtrFactory<LoggingRaw> weak_factory_; |
| 83 | 94 |
| 84 DISALLOW_COPY_AND_ASSIGN(LoggingRaw); | 95 DISALLOW_COPY_AND_ASSIGN(LoggingRaw); |
| 85 }; | 96 }; |
| 86 | 97 |
| 87 } // namespace cast | 98 } // namespace cast |
| 88 } // namespace media | 99 } // namespace media |
| 89 | 100 |
| 90 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_ | 101 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_ |
| 91 | 102 |
| OLD | NEW |