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