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

Side by Side Diff: media/cast/video_sender/video_sender.cc

Issue 322953004: Cast: Don't cancel re-transmission for some cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/video_sender/video_sender.h" 5 #include "media/cast/video_sender/video_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 309 }
310 // TODO(miu): The values "2" and "3" should be derived from configuration. 310 // TODO(miu): The values "2" and "3" should be derived from configuration.
311 if (duplicate_ack_counter_ >= 2 && duplicate_ack_counter_ % 3 == 2) { 311 if (duplicate_ack_counter_ >= 2 && duplicate_ack_counter_ % 3 == 2) {
312 VLOG(1) << "Received duplicate ACK for frame " << latest_acked_frame_id_; 312 VLOG(1) << "Received duplicate ACK for frame " << latest_acked_frame_id_;
313 ResendForKickstart(); 313 ResendForKickstart();
314 } 314 }
315 } else { 315 } else {
316 // Only count duplicated ACKs if there is no NACK request in between. 316 // Only count duplicated ACKs if there is no NACK request in between.
317 // This is to avoid aggresive resend. 317 // This is to avoid aggresive resend.
318 duplicate_ack_counter_ = 0; 318 duplicate_ack_counter_ = 0;
319
320 // A NACK is also used to cancel pending re-transmissions.
319 transport_sender_->ResendPackets( 321 transport_sender_->ResendPackets(
320 false, cast_feedback.missing_frames_and_packets_); 322 false, cast_feedback.missing_frames_and_packets_, true);
321 uint32 new_bitrate = 0; 323 uint32 new_bitrate = 0;
322 if (congestion_control_.OnNack(rtt, &new_bitrate)) { 324 if (congestion_control_.OnNack(rtt, &new_bitrate)) {
323 UpdateBitrate(new_bitrate); 325 UpdateBitrate(new_bitrate);
324 } 326 }
325 } 327 }
326 328
327 RtpTimestamp rtp_timestamp = 329 RtpTimestamp rtp_timestamp =
328 frame_id_to_rtp_timestamp_[cast_feedback.ack_frame_id_ & 0xff]; 330 frame_id_to_rtp_timestamp_[cast_feedback.ack_frame_id_ & 0xff];
329 cast_environment_->Logging()->InsertFrameEvent( 331 cast_environment_->Logging()->InsertFrameEvent(
330 cast_environment_->Clock()->NowTicks(), FRAME_ACK_RECEIVED, VIDEO_EVENT, 332 cast_environment_->Clock()->NowTicks(), FRAME_ACK_RECEIVED, VIDEO_EVENT,
(...skipping 29 matching lines...) Expand all
360 << " to kick-start."; 362 << " to kick-start.";
361 // Send the first packet of the last encoded frame to kick start 363 // Send the first packet of the last encoded frame to kick start
362 // retransmission. This gives enough information to the receiver what 364 // retransmission. This gives enough information to the receiver what
363 // packets and frames are missing. 365 // packets and frames are missing.
364 MissingFramesAndPacketsMap missing_frames_and_packets; 366 MissingFramesAndPacketsMap missing_frames_and_packets;
365 PacketIdSet missing; 367 PacketIdSet missing;
366 missing.insert(0); 368 missing.insert(0);
367 missing_frames_and_packets.insert( 369 missing_frames_and_packets.insert(
368 std::make_pair(last_sent_frame_id_, missing)); 370 std::make_pair(last_sent_frame_id_, missing));
369 last_send_time_ = cast_environment_->Clock()->NowTicks(); 371 last_send_time_ = cast_environment_->Clock()->NowTicks();
370 transport_sender_->ResendPackets(false, missing_frames_and_packets); 372
373 // Sending this extra packet is to kick-start the session. There is
374 // no need to optimize re-transmission for this case.
375 transport_sender_->ResendPackets(false, missing_frames_and_packets,
376 false);
371 } 377 }
372 378
373 void VideoSender::UpdateBitrate(int new_bitrate) { 379 void VideoSender::UpdateBitrate(int new_bitrate) {
374 // Make sure we don't set the bitrate too insanely low. 380 // Make sure we don't set the bitrate too insanely low.
375 DCHECK_GT(new_bitrate, 1000); 381 DCHECK_GT(new_bitrate, 1000);
376 video_encoder_->SetBitRate(new_bitrate); 382 video_encoder_->SetBitRate(new_bitrate);
377 current_requested_bitrate_ = new_bitrate; 383 current_requested_bitrate_ = new_bitrate;
378 } 384 }
379 385
380 } // namespace cast 386 } // namespace cast
381 } // namespace media 387 } // namespace media
OLDNEW
« media/cast/transport/cast_transport_sender.h ('K') | « media/cast/transport/rtp_sender/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698