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 #include "media/cast/net/cast_transport_sender_impl.h" | 5 #include "media/cast/net/cast_transport_sender_impl.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "media/cast/net/cast_transport_config.h" | 8 #include "media/cast/net/cast_transport_config.h" |
9 #include "media/cast/net/cast_transport_defines.h" | 9 #include "media/cast/net/cast_transport_defines.h" |
10 #include "media/cast/net/udp_transport.h" | 10 #include "media/cast/net/udp_transport.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 video_sender_->CancelSendingFrames(frame_ids); | 215 video_sender_->CancelSendingFrames(frame_ids); |
216 } else { | 216 } else { |
217 NOTREACHED() << "Invalid request for cancel sending."; | 217 NOTREACHED() << "Invalid request for cancel sending."; |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 void CastTransportSenderImpl::ResendFrameForKickstart(uint32 ssrc, | 221 void CastTransportSenderImpl::ResendFrameForKickstart(uint32 ssrc, |
222 uint32 frame_id) { | 222 uint32 frame_id) { |
223 if (audio_sender_ && ssrc == audio_sender_->ssrc()) { | 223 if (audio_sender_ && ssrc == audio_sender_->ssrc()) { |
224 DCHECK(audio_rtcp_session_); | 224 DCHECK(audio_rtcp_session_); |
225 audio_sender_->ResendFrameForKickstart(frame_id, | 225 audio_sender_->ResendFrameForKickstart( |
226 audio_rtcp_session_->rtt()); | 226 frame_id, |
| 227 audio_rtcp_session_->current_round_trip_time()); |
227 } else if (video_sender_ && ssrc == video_sender_->ssrc()) { | 228 } else if (video_sender_ && ssrc == video_sender_->ssrc()) { |
228 DCHECK(video_rtcp_session_); | 229 DCHECK(video_rtcp_session_); |
229 video_sender_->ResendFrameForKickstart(frame_id, | 230 video_sender_->ResendFrameForKickstart( |
230 video_rtcp_session_->rtt()); | 231 frame_id, |
| 232 video_rtcp_session_->current_round_trip_time()); |
231 } else { | 233 } else { |
232 NOTREACHED() << "Invalid request for kickstart."; | 234 NOTREACHED() << "Invalid request for kickstart."; |
233 } | 235 } |
234 } | 236 } |
235 | 237 |
236 void CastTransportSenderImpl::ResendPackets( | 238 void CastTransportSenderImpl::ResendPackets( |
237 uint32 ssrc, | 239 uint32 ssrc, |
238 const MissingFramesAndPacketsMap& missing_packets, | 240 const MissingFramesAndPacketsMap& missing_packets, |
239 bool cancel_rtx_if_not_in_list, | 241 bool cancel_rtx_if_not_in_list, |
240 const DedupInfo& dedup_info) { | 242 const DedupInfo& dedup_info) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 if (!cast_message_cb.is_null()) | 333 if (!cast_message_cb.is_null()) |
332 cast_message_cb.Run(cast_message); | 334 cast_message_cb.Run(cast_message); |
333 | 335 |
334 DedupInfo dedup_info; | 336 DedupInfo dedup_info; |
335 if (audio_sender_ && audio_sender_->ssrc() == ssrc) { | 337 if (audio_sender_ && audio_sender_->ssrc() == ssrc) { |
336 const int64 acked_bytes = | 338 const int64 acked_bytes = |
337 audio_sender_->GetLastByteSentForFrame(cast_message.ack_frame_id); | 339 audio_sender_->GetLastByteSentForFrame(cast_message.ack_frame_id); |
338 last_byte_acked_for_audio_ = | 340 last_byte_acked_for_audio_ = |
339 std::max(acked_bytes, last_byte_acked_for_audio_); | 341 std::max(acked_bytes, last_byte_acked_for_audio_); |
340 } else if (video_sender_ && video_sender_->ssrc() == ssrc) { | 342 } else if (video_sender_ && video_sender_->ssrc() == ssrc) { |
341 dedup_info.resend_interval = video_rtcp_session_->rtt(); | 343 dedup_info.resend_interval = video_rtcp_session_->current_round_trip_time(); |
342 | 344 |
343 // Only use audio stream to dedup if there is one. | 345 // Only use audio stream to dedup if there is one. |
344 if (audio_sender_) { | 346 if (audio_sender_) { |
345 dedup_info.last_byte_acked_for_audio = last_byte_acked_for_audio_; | 347 dedup_info.last_byte_acked_for_audio = last_byte_acked_for_audio_; |
346 } | 348 } |
347 } | 349 } |
348 | 350 |
349 if (cast_message.missing_frames_and_packets.empty()) | 351 if (cast_message.missing_frames_and_packets.empty()) |
350 return; | 352 return; |
351 | 353 |
352 // This call does two things. | 354 // This call does two things. |
353 // 1. Specifies that retransmissions for packets not listed in the set are | 355 // 1. Specifies that retransmissions for packets not listed in the set are |
354 // cancelled. | 356 // cancelled. |
355 // 2. Specifies a deduplication window. For video this would be the most | 357 // 2. Specifies a deduplication window. For video this would be the most |
356 // recent RTT. For audio there is no deduplication. | 358 // recent RTT. For audio there is no deduplication. |
357 ResendPackets(ssrc, | 359 ResendPackets(ssrc, |
358 cast_message.missing_frames_and_packets, | 360 cast_message.missing_frames_and_packets, |
359 true, | 361 true, |
360 dedup_info); | 362 dedup_info); |
361 } | 363 } |
362 | 364 |
363 } // namespace cast | 365 } // namespace cast |
364 } // namespace media | 366 } // namespace media |
OLD | NEW |