OLD | NEW |
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 // This is the base class for an object that send frames to a receiver. | 5 // This is the base class for an object that send frames to a receiver. |
6 // TODO(hclam): Refactor such that there is no separate AudioSender vs. | 6 // TODO(hclam): Refactor such that there is no separate AudioSender vs. |
7 // VideoSender, and the functionality of both is rolled into this class. | 7 // VideoSender, and the functionality of both is rolled into this class. |
8 | 8 |
9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Returns true if too many frames would be in-flight by encoding and sending | 94 // Returns true if too many frames would be in-flight by encoding and sending |
95 // the next frame having the given |frame_duration|. | 95 // the next frame having the given |frame_duration|. |
96 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; | 96 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; |
97 | 97 |
98 // Record or retrieve a recent history of each frame's timestamps. | 98 // Record or retrieve a recent history of each frame's timestamps. |
99 // Warning: If a frame ID too far in the past is requested, the getters will | 99 // Warning: If a frame ID too far in the past is requested, the getters will |
100 // silently succeed but return incorrect values. Be sure to respect | 100 // silently succeed but return incorrect values. Be sure to respect |
101 // media::cast::kMaxUnackedFrames. | 101 // media::cast::kMaxUnackedFrames. |
102 void RecordLatestFrameTimestamps(uint32_t frame_id, | 102 void RecordLatestFrameTimestamps(uint32_t frame_id, |
103 base::TimeTicks reference_time, | 103 base::TimeTicks reference_time, |
104 RtpTimestamp rtp_timestamp); | 104 RtpTimeTicks rtp_timestamp); |
105 base::TimeTicks GetRecordedReferenceTime(uint32_t frame_id) const; | 105 base::TimeTicks GetRecordedReferenceTime(uint32_t frame_id) const; |
106 RtpTimestamp GetRecordedRtpTimestamp(uint32_t frame_id) const; | 106 RtpTimeTicks GetRecordedRtpTimestamp(uint32_t frame_id) const; |
107 | 107 |
108 // Returns the number of frames that were sent but not yet acknowledged. | 108 // Returns the number of frames that were sent but not yet acknowledged. |
109 int GetUnacknowledgedFrameCount() const; | 109 int GetUnacknowledgedFrameCount() const; |
110 | 110 |
111 // Playout delay represents total amount of time between a frame's | 111 // Playout delay represents total amount of time between a frame's |
112 // capture/recording on the sender and its playback on the receiver | 112 // capture/recording on the sender and its playback on the receiver |
113 // (i.e., shown to a user). This should be a value large enough to | 113 // (i.e., shown to a user). This should be a value large enough to |
114 // give the system sufficient time to encode, transmit/retransmit, | 114 // give the system sufficient time to encode, transmit/retransmit, |
115 // receive, decode, and render; given its run-time environment | 115 // receive, decode, and render; given its run-time environment |
116 // (sender/receiver hardware performance, network conditions,etc.). | 116 // (sender/receiver hardware performance, network conditions,etc.). |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // RTP timestamp increment representing one second. | 173 // RTP timestamp increment representing one second. |
174 const int rtp_timebase_; | 174 const int rtp_timebase_; |
175 | 175 |
176 const bool is_audio_; | 176 const bool is_audio_; |
177 | 177 |
178 // Ring buffers to keep track of recent frame timestamps (both in terms of | 178 // Ring buffers to keep track of recent frame timestamps (both in terms of |
179 // local reference time and RTP media time). These should only be accessed | 179 // local reference time and RTP media time). These should only be accessed |
180 // through the Record/GetXXX() methods. | 180 // through the Record/GetXXX() methods. |
181 base::TimeTicks frame_reference_times_[256]; | 181 base::TimeTicks frame_reference_times_[256]; |
182 RtpTimestamp frame_rtp_timestamps_[256]; | 182 RtpTimeTicks frame_rtp_timestamps_[256]; |
183 | 183 |
184 // NOTE: Weak pointers must be invalidated before all other member variables. | 184 // NOTE: Weak pointers must be invalidated before all other member variables. |
185 base::WeakPtrFactory<FrameSender> weak_factory_; | 185 base::WeakPtrFactory<FrameSender> weak_factory_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 187 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace cast | 190 } // namespace cast |
191 } // namespace media | 191 } // namespace media |
192 | 192 |
193 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 193 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
OLD | NEW |