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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // speculatively re-send certain packets of an unacked frame to kick-start | 85 // speculatively re-send certain packets of an unacked frame to kick-start |
86 // re-transmission. This is a last resort tactic to prevent the session from | 86 // re-transmission. This is a last resort tactic to prevent the session from |
87 // getting stuck after a long outage. | 87 // getting stuck after a long outage. |
88 void ScheduleNextResendCheck(); | 88 void ScheduleNextResendCheck(); |
89 void ResendCheck(); | 89 void ResendCheck(); |
90 void ResendForKickstart(); | 90 void ResendForKickstart(); |
91 | 91 |
92 // Protected for testability. | 92 // Protected for testability. |
93 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); | 93 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
94 | 94 |
95 // Called when receiving a Pli message from the receiver. | |
96 void OnReceivedPli(); | |
97 | |
95 // Returns true if too many frames would be in-flight by encoding and sending | 98 // Returns true if too many frames would be in-flight by encoding and sending |
96 // the next frame having the given |frame_duration|. | 99 // the next frame having the given |frame_duration|. |
97 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; | 100 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; |
98 | 101 |
99 // Record or retrieve a recent history of each frame's timestamps. | 102 // Record or retrieve a recent history of each frame's timestamps. |
100 // Warning: If a frame ID too far in the past is requested, the getters will | 103 // Warning: If a frame ID too far in the past is requested, the getters will |
101 // silently succeed but return incorrect values. Be sure to respect | 104 // silently succeed but return incorrect values. Be sure to respect |
102 // media::cast::kMaxUnackedFrames. | 105 // media::cast::kMaxUnackedFrames. |
103 void RecordLatestFrameTimestamps(uint32_t frame_id, | 106 void RecordLatestFrameTimestamps(uint32_t frame_id, |
104 base::TimeTicks reference_time, | 107 base::TimeTicks reference_time, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 // case, VideoSender will trigger a re-send of the next frame. | 162 // case, VideoSender will trigger a re-send of the next frame. |
160 int duplicate_ack_counter_; | 163 int duplicate_ack_counter_; |
161 | 164 |
162 // This object controls how we change the bitrate to make sure the | 165 // This object controls how we change the bitrate to make sure the |
163 // buffer doesn't overflow. | 166 // buffer doesn't overflow. |
164 scoped_ptr<CongestionControl> congestion_control_; | 167 scoped_ptr<CongestionControl> congestion_control_; |
165 | 168 |
166 // The most recently measured round trip time. | 169 // The most recently measured round trip time. |
167 base::TimeDelta current_round_trip_time_; | 170 base::TimeDelta current_round_trip_time_; |
168 | 171 |
172 // This flag is set true when received a Pli message from the receiver. It is | |
173 // cleared after FrameSender receiving an encoded key frame. | |
174 bool picture_lost_at_receiver_; | |
Irfan
2016/02/29 16:01:23
may be: This flag is set to true when a PLI messag
xjz
2016/02/29 19:48:58
Done.
| |
175 | |
169 private: | 176 private: |
170 // Returns the maximum media duration currently allowed in-flight. This | 177 // Returns the maximum media duration currently allowed in-flight. This |
171 // fluctuates in response to the currently-measured network latency. | 178 // fluctuates in response to the currently-measured network latency. |
172 base::TimeDelta GetAllowedInFlightMediaDuration() const; | 179 base::TimeDelta GetAllowedInFlightMediaDuration() const; |
173 | 180 |
174 // RTP timestamp increment representing one second. | 181 // RTP timestamp increment representing one second. |
175 const int rtp_timebase_; | 182 const int rtp_timebase_; |
176 | 183 |
177 const bool is_audio_; | 184 const bool is_audio_; |
178 | 185 |
179 // Ring buffers to keep track of recent frame timestamps (both in terms of | 186 // Ring buffers to keep track of recent frame timestamps (both in terms of |
180 // local reference time and RTP media time). These should only be accessed | 187 // local reference time and RTP media time). These should only be accessed |
181 // through the Record/GetXXX() methods. | 188 // through the Record/GetXXX() methods. |
182 base::TimeTicks frame_reference_times_[256]; | 189 base::TimeTicks frame_reference_times_[256]; |
183 RtpTimeTicks frame_rtp_timestamps_[256]; | 190 RtpTimeTicks frame_rtp_timestamps_[256]; |
184 | 191 |
185 // NOTE: Weak pointers must be invalidated before all other member variables. | 192 // NOTE: Weak pointers must be invalidated before all other member variables. |
186 base::WeakPtrFactory<FrameSender> weak_factory_; | 193 base::WeakPtrFactory<FrameSender> weak_factory_; |
187 | 194 |
188 DISALLOW_COPY_AND_ASSIGN(FrameSender); | 195 DISALLOW_COPY_AND_ASSIGN(FrameSender); |
189 }; | 196 }; |
190 | 197 |
191 } // namespace cast | 198 } // namespace cast |
192 } // namespace media | 199 } // namespace media |
193 | 200 |
194 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | 201 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ |
OLD | NEW |