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

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

Issue 1309433002: Report better error message on update sandbox for gn builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cast events to about:tracing Created 5 years, 3 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/audio_encoder.cc ('k') | media/cast/sender/frame_sender.cc » ('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 // The purpose of this file is determine what bitrate to use for mirroring. 5 // The purpose of this file is determine what bitrate to use for mirroring.
6 // Ideally this should be as much as possible, without causing any frames to 6 // Ideally this should be as much as possible, without causing any frames to
7 // arrive late. 7 // arrive late.
8 8
9 // The current algorithm is to measure how much bandwidth we've been using 9 // The current algorithm is to measure how much bandwidth we've been using
10 // recently. We also keep track of how much data has been queued up for sending 10 // recently. We also keep track of how much data has been queued up for sending
11 // in a virtual "buffer" (this virtual buffer represents all the buffers between 11 // in a virtual "buffer" (this virtual buffer represents all the buffers between
12 // the sender and the receiver, including retransmissions and so forth.) 12 // the sender and the receiver, including retransmissions and so forth.)
13 // If we estimate that our virtual buffer is mostly empty, we try to use 13 // If we estimate that our virtual buffer is mostly empty, we try to use
14 // more bandwidth than our recent usage, otherwise we use less. 14 // more bandwidth than our recent usage, otherwise we use less.
15 15
16 #include "media/cast/sender/congestion_control.h" 16 #include "media/cast/sender/congestion_control.h"
17 17
18 #include <deque> 18 #include <deque>
19 19
20 #include "base/logging.h" 20 #include "base/logging.h"
21 #include "base/trace_event/trace_event.h"
21 #include "media/cast/cast_config.h" 22 #include "media/cast/cast_config.h"
22 #include "media/cast/cast_defines.h" 23 #include "media/cast/cast_defines.h"
23 24
24 namespace media { 25 namespace media {
25 namespace cast { 26 namespace cast {
26 27
27 class AdaptiveCongestionControl : public CongestionControl { 28 class AdaptiveCongestionControl : public CongestionControl {
28 public: 29 public:
29 AdaptiveCongestionControl(base::TickClock* clock, 30 AdaptiveCongestionControl(base::TickClock* clock,
30 uint32 max_bitrate_configured, 31 uint32 max_bitrate_configured,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 double empty_buffer_fraction = 361 double empty_buffer_fraction =
361 time_to_catch_up.InSecondsF() / playout_delay.InSecondsF(); 362 time_to_catch_up.InSecondsF() / playout_delay.InSecondsF();
362 empty_buffer_fraction = std::min(empty_buffer_fraction, 1.0); 363 empty_buffer_fraction = std::min(empty_buffer_fraction, 1.0);
363 empty_buffer_fraction = std::max(empty_buffer_fraction, 0.0); 364 empty_buffer_fraction = std::max(empty_buffer_fraction, 0.0);
364 365
365 uint32 bits_per_second = static_cast<uint32>( 366 uint32 bits_per_second = static_cast<uint32>(
366 safe_bitrate * empty_buffer_fraction / kTargetEmptyBufferFraction); 367 safe_bitrate * empty_buffer_fraction / kTargetEmptyBufferFraction);
367 VLOG(3) << " FBR:" << (bits_per_second / 1E6) 368 VLOG(3) << " FBR:" << (bits_per_second / 1E6)
368 << " EBF:" << empty_buffer_fraction 369 << " EBF:" << empty_buffer_fraction
369 << " SBR:" << (safe_bitrate / 1E6); 370 << " SBR:" << (safe_bitrate / 1E6);
371 TRACE_COUNTER_ID1("cast.stream", "Empty Buffer Fraction", this,
372 empty_buffer_fraction);
373
370 bits_per_second = std::max(bits_per_second, min_bitrate_configured_); 374 bits_per_second = std::max(bits_per_second, min_bitrate_configured_);
371 bits_per_second = std::min(bits_per_second, max_bitrate_configured_); 375 bits_per_second = std::min(bits_per_second, max_bitrate_configured_);
372 return bits_per_second; 376 return bits_per_second;
373 } 377 }
374 378
375 } // namespace cast 379 } // namespace cast
376 } // namespace media 380 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/audio_encoder.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698