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

Side by Side Diff: media/cast/sender/frame_sender.cc

Issue 629493004: [Cast] Clean-up: Move max_unacked_frames into CongestionControl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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
« no previous file with comments | « media/cast/sender/frame_sender.h ('k') | media/cast/sender/video_encoder_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sender/frame_sender.h" 5 #include "media/cast/sender/frame_sender.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 8
9 namespace media { 9 namespace media {
10 namespace cast { 10 namespace cast {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ScheduleNextRtcpReport(); 99 ScheduleNextRtcpReport();
100 } 100 }
101 101
102 void FrameSender::OnMeasuredRoundTripTime(base::TimeDelta rtt) { 102 void FrameSender::OnMeasuredRoundTripTime(base::TimeDelta rtt) {
103 DCHECK(rtt > base::TimeDelta()); 103 DCHECK(rtt > base::TimeDelta());
104 current_round_trip_time_ = rtt; 104 current_round_trip_time_ = rtt;
105 } 105 }
106 106
107 void FrameSender::SetTargetPlayoutDelay( 107 void FrameSender::SetTargetPlayoutDelay(
108 base::TimeDelta new_target_playout_delay) { 108 base::TimeDelta new_target_playout_delay) {
109 if (send_target_playout_delay_ &&
110 target_playout_delay_ == new_target_playout_delay) {
111 return;
112 }
109 new_target_playout_delay = std::max(new_target_playout_delay, 113 new_target_playout_delay = std::max(new_target_playout_delay,
110 min_playout_delay_); 114 min_playout_delay_);
111 new_target_playout_delay = std::min(new_target_playout_delay, 115 new_target_playout_delay = std::min(new_target_playout_delay,
112 max_playout_delay_); 116 max_playout_delay_);
117 VLOG(2) << SENDER_SSRC << "Target playout delay changing from "
118 << target_playout_delay_.InMilliseconds() << " ms to "
119 << new_target_playout_delay.InMilliseconds() << " ms.";
113 target_playout_delay_ = new_target_playout_delay; 120 target_playout_delay_ = new_target_playout_delay;
114 max_unacked_frames_ =
115 std::min(kMaxUnackedFrames,
116 1 + static_cast<int>(target_playout_delay_ *
117 max_frame_rate_ /
118 base::TimeDelta::FromSeconds(1)));
119 send_target_playout_delay_ = true; 121 send_target_playout_delay_ = true;
122 congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay_);
120 } 123 }
121 124
122 void FrameSender::ResendCheck() { 125 void FrameSender::ResendCheck() {
123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 126 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
124 DCHECK(!last_send_time_.is_null()); 127 DCHECK(!last_send_time_.is_null());
125 const base::TimeDelta time_since_last_send = 128 const base::TimeDelta time_since_last_send =
126 cast_environment_->Clock()->NowTicks() - last_send_time_; 129 cast_environment_->Clock()->NowTicks() - last_send_time_;
127 if (time_since_last_send > target_playout_delay_) { 130 if (time_since_last_send > target_playout_delay_) {
128 if (latest_acked_frame_id_ == last_sent_frame_id_) { 131 if (latest_acked_frame_id_ == last_sent_frame_id_) {
129 // Last frame acked, no point in doing anything 132 // Last frame acked, no point in doing anything
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 VLOG(1) << SENDER_SSRC << "Dropping: In-flight duration would be too high."; 376 VLOG(1) << SENDER_SSRC << "Dropping: In-flight duration would be too high.";
374 return true; 377 return true;
375 } 378 }
376 379
377 // Next frame is accepted. 380 // Next frame is accepted.
378 return false; 381 return false;
379 } 382 }
380 383
381 } // namespace cast 384 } // namespace cast
382 } // namespace media 385 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/frame_sender.h ('k') | media/cast/sender/video_encoder_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698