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

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

Issue 1515433002: Replace uses of raw uint32's with a type-checked RtpTimeTicks data type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mkwst's comments, plus REBASE. Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_ENCODING_EVENT_SUBSCRIBER_H_ 5 #ifndef MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
6 #define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ 6 #define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Assigns frame events and packet events received so far to |frame_events| 58 // Assigns frame events and packet events received so far to |frame_events|
59 // and |packet_events| and resets the internal state. 59 // and |packet_events| and resets the internal state.
60 // In addition, assign metadata associated with these events to |metadata|. 60 // In addition, assign metadata associated with these events to |metadata|.
61 // The protos in |frame_events| and |packets_events| are sorted in 61 // The protos in |frame_events| and |packets_events| are sorted in
62 // ascending RTP timestamp order. 62 // ascending RTP timestamp order.
63 void GetEventsAndReset(media::cast::proto::LogMetadata* metadata, 63 void GetEventsAndReset(media::cast::proto::LogMetadata* metadata,
64 FrameEventList* frame_events, 64 FrameEventList* frame_events,
65 PacketEventList* packet_events); 65 PacketEventList* packet_events);
66 66
67 private: 67 private:
68 typedef std::map<RtpTimestamp, 68 typedef std::map<RtpTimeDelta,
69 linked_ptr<media::cast::proto::AggregatedFrameEvent> > 69 linked_ptr<media::cast::proto::AggregatedFrameEvent>>
70 FrameEventMap; 70 FrameEventMap;
71 typedef std::map<RtpTimestamp, 71 typedef std::map<RtpTimeDelta,
72 linked_ptr<media::cast::proto::AggregatedPacketEvent> > 72 linked_ptr<media::cast::proto::AggregatedPacketEvent>>
73 PacketEventMap; 73 PacketEventMap;
74 74
75 // Transfer up to |max_num_entries| smallest entries from |frame_event_map_| 75 // Transfer up to |max_num_entries| smallest entries from |frame_event_map_|
76 // to |frame_event_storage_|. This helps keep size of |frame_event_map_| small 76 // to |frame_event_storage_|. This helps keep size of |frame_event_map_| small
77 // and lookup speed fast. 77 // and lookup speed fast.
78 void TransferFrameEvents(size_t max_num_entries); 78 void TransferFrameEvents(size_t max_num_entries);
79 // See above. 79 // See above.
80 void TransferPacketEvents(size_t max_num_entries); 80 void TransferPacketEvents(size_t max_num_entries);
81 81
82 void AddFrameEventToStorage( 82 void AddFrameEventToStorage(
83 const linked_ptr<media::cast::proto::AggregatedFrameEvent>& 83 const linked_ptr<media::cast::proto::AggregatedFrameEvent>&
84 frame_event_proto); 84 frame_event_proto);
85 void AddPacketEventToStorage( 85 void AddPacketEventToStorage(
86 const linked_ptr<media::cast::proto::AggregatedPacketEvent>& 86 const linked_ptr<media::cast::proto::AggregatedPacketEvent>&
87 packet_event_proto); 87 packet_event_proto);
88 88
89 // Returns the difference between |rtp_timestamp| and |first_rtp_timestamp_|. 89 // Returns the difference between |rtp_timestamp| and |first_rtp_timestamp_|.
90 // Sets |first_rtp_timestamp_| if it is not already set. 90 // Sets |first_rtp_timestamp_| if it is not already set.
91 RtpTimestamp GetRelativeRtpTimestamp(RtpTimestamp rtp_timestamp); 91 RtpTimeDelta GetRelativeRtpTimestamp(RtpTimeTicks rtp_timestamp);
92 92
93 // Clears the maps and first RTP timestamp seen. 93 // Clears the maps and first RTP timestamp seen.
94 void Reset(); 94 void Reset();
95 95
96 const EventMediaType event_media_type_; 96 const EventMediaType event_media_type_;
97 const size_t max_frames_; 97 const size_t max_frames_;
98 98
99 FrameEventMap frame_event_map_; 99 FrameEventMap frame_event_map_;
100 FrameEventList frame_event_storage_; 100 FrameEventList frame_event_storage_;
101 int frame_event_storage_index_; 101 int frame_event_storage_index_;
102 102
103 PacketEventMap packet_event_map_; 103 PacketEventMap packet_event_map_;
104 PacketEventList packet_event_storage_; 104 PacketEventList packet_event_storage_;
105 int packet_event_storage_index_; 105 int packet_event_storage_index_;
106 106
107 // All functions must be called on the main thread. 107 // All functions must be called on the main thread.
108 base::ThreadChecker thread_checker_; 108 base::ThreadChecker thread_checker_;
109 109
110 // Set to true on first event encountered after a |Reset()|. 110 // Set to true on first event encountered after a |Reset()|.
111 bool seen_first_rtp_timestamp_; 111 bool seen_first_rtp_timestamp_;
112 112
113 // Set to RTP timestamp of first event encountered after a |Reset()|. 113 // Set to RTP timestamp of first event encountered after a |Reset()|.
114 RtpTimestamp first_rtp_timestamp_; 114 RtpTimeTicks first_rtp_timestamp_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber); 116 DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber);
117 }; 117 };
118 118
119 } // namespace cast 119 } // namespace cast
120 } // namespace media 120 } // namespace media
121 121
122 #endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ 122 #endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698