Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: media/cast/logging/logging_raw.h

Issue 270493003: Cast: Deduplicate event types in cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/logging/logging_impl_unittest.cc ('k') | media/cast/logging/logging_raw.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "base/time/tick_clock.h" 13 #include "base/time/tick_clock.h"
14 #include "media/cast/logging/logging_defines.h" 14 #include "media/cast/logging/logging_defines.h"
15 #include "media/cast/logging/raw_event_subscriber.h" 15 #include "media/cast/logging/raw_event_subscriber.h"
16 16
17 namespace media { 17 namespace media {
18 namespace cast { 18 namespace cast {
19 19
20 // This class is not thread safe, and should only be called from the main 20 // This class is not thread safe, and should only be called from the main
21 // thread. 21 // thread.
22 class LoggingRaw : public base::NonThreadSafe { 22 class LoggingRaw : public base::NonThreadSafe {
23 public: 23 public:
24 LoggingRaw(); 24 LoggingRaw();
25 ~LoggingRaw(); 25 ~LoggingRaw();
26 26
27 // Inform of new event: two types of events: frame and packet. 27 // Inform of new event: two types of events: frame and packet.
28 // Frame events can be inserted with different parameters. 28 // Frame events can be inserted with different parameters.
29 void InsertFrameEvent(const base::TimeTicks& time_of_event, 29 void InsertFrameEvent(const base::TimeTicks& time_of_event,
30 CastLoggingEvent event, uint32 rtp_timestamp, 30 CastLoggingEvent event, EventMediaType event_media_type,
31 uint32 frame_id); 31 uint32 rtp_timestamp, uint32 frame_id);
32 32
33 // This function is only applicable for the following frame events: 33 // This function is only applicable for FRAME_ENCODED event.
34 // kAudioFrameEncoded, kVideoFrameEncoded
35 // |size| - Size of encoded frame. 34 // |size| - Size of encoded frame.
36 // |key_frame| - Whether the frame is a key frame. This field is only 35 // |key_frame| - Whether the frame is a key frame. This field is only
37 // applicable for kVideoFrameEncoded event. 36 // applicable for video event.
38 // |target_bitrate| - The target bitrate of the encoder the time the frame 37 // |target_bitrate| - The target bitrate of the encoder the time the frame
39 // was encoded. Only applicable for kVideoFrameEncoded event. 38 // was encoded. Only applicable for video event.
40 void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event, 39 void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
41 CastLoggingEvent event, uint32 rtp_timestamp, 40 CastLoggingEvent event,
42 uint32 frame_id, int size, bool key_frame, 41 EventMediaType event_media_type,
42 uint32 rtp_timestamp, uint32 frame_id,
43 int size, bool key_frame,
43 int target_bitrate); 44 int target_bitrate);
44 45
45 // Render/playout delay 46 // Render/playout delay
46 // This function is only applicable for the following frame events: 47 // This function is only applicable for FRAME_PLAYOUT event.
47 // kAudioPlayoutDelay, kVideoRenderDelay
48 void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event, 48 void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
49 CastLoggingEvent event, uint32 rtp_timestamp, 49 CastLoggingEvent event,
50 EventMediaType event_media_type,
51 uint32 rtp_timestamp,
50 uint32 frame_id, base::TimeDelta delay); 52 uint32 frame_id, base::TimeDelta delay);
51 53
52 // Insert a packet event. 54 // Insert a packet event.
53 void InsertPacketEvent(const base::TimeTicks& time_of_event, 55 void InsertPacketEvent(const base::TimeTicks& time_of_event,
54 CastLoggingEvent event, uint32 rtp_timestamp, 56 CastLoggingEvent event,
57 EventMediaType event_media_type, uint32 rtp_timestamp,
55 uint32 frame_id, uint16 packet_id, 58 uint32 frame_id, uint16 packet_id,
56 uint16 max_packet_id, size_t size); 59 uint16 max_packet_id, size_t size);
57 60
58 // Adds |subscriber| so that it will start receiving events on main thread. 61 // Adds |subscriber| so that it will start receiving events on main thread.
59 // Note that this class does not own |subscriber|. 62 // Note that this class does not own |subscriber|.
60 // It is a no-op to add a subscriber that already exists. 63 // It is a no-op to add a subscriber that already exists.
61 void AddSubscriber(RawEventSubscriber* subscriber); 64 void AddSubscriber(RawEventSubscriber* subscriber);
62 65
63 // Removes |subscriber| so that it will stop receiving events. 66 // Removes |subscriber| so that it will stop receiving events.
64 // Note that this class does NOT own the subscribers. This function MUST be 67 // Note that this class does NOT own the subscribers. This function MUST be
65 // called before |subscriber| is destroyed if it was previously added. 68 // called before |subscriber| is destroyed if it was previously added.
66 // It is a no-op to remove a subscriber that doesn't exist. 69 // It is a no-op to remove a subscriber that doesn't exist.
67 void RemoveSubscriber(RawEventSubscriber* subscriber); 70 void RemoveSubscriber(RawEventSubscriber* subscriber);
68 71
69 private: 72 private:
70 void InsertBaseFrameEvent(const base::TimeTicks& time_of_event, 73 void InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
71 CastLoggingEvent event, uint32 frame_id, 74 CastLoggingEvent event,
72 uint32 rtp_timestamp, base::TimeDelta delay, 75 EventMediaType event_media_type,
73 int size, bool key_frame, int target_bitrate); 76 uint32 frame_id, uint32 rtp_timestamp,
77 base::TimeDelta delay, int size, bool key_frame,
78 int target_bitrate);
74 79
75 // List of subscriber pointers. This class does not own the subscribers. 80 // List of subscriber pointers. This class does not own the subscribers.
76 std::vector<RawEventSubscriber*> subscribers_; 81 std::vector<RawEventSubscriber*> subscribers_;
77 82
78 DISALLOW_COPY_AND_ASSIGN(LoggingRaw); 83 DISALLOW_COPY_AND_ASSIGN(LoggingRaw);
79 }; 84 };
80 85
81 } // namespace cast 86 } // namespace cast
82 } // namespace media 87 } // namespace media
83 88
84 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_ 89 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_
OLDNEW
« no previous file with comments | « media/cast/logging/logging_impl_unittest.cc ('k') | media/cast/logging/logging_raw.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698