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

Unified Diff: media/blink/buffered_resource_loader.cc

Issue 1094783002: Switch to double for time calculations using playback rate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Making changes at chromecast side to fix trybots Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/blink/buffered_resource_loader.h ('k') | media/blink/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/buffered_resource_loader.cc
diff --git a/media/blink/buffered_resource_loader.cc b/media/blink/buffered_resource_loader.cc
index b2598eaee8579c1f69f85450cd1a79af7344f652..51ec8fe99e3fe1c4ff92c6558ffbfe79cce6058e 100644
--- a/media/blink/buffered_resource_loader.cc
+++ b/media/blink/buffered_resource_loader.cc
@@ -54,12 +54,12 @@ static const int kForwardWaitThreshold = 2 * kMegabyte;
// Computes the suggested backward and forward capacity for the buffer
// if one wants to play at |playback_rate| * the natural playback speed.
// Use a value of 0 for |bitrate| if it is unknown.
-static void ComputeTargetBufferWindow(float playback_rate, int bitrate,
+static void ComputeTargetBufferWindow(double playback_rate, int bitrate,
int* out_backward_capacity,
int* out_forward_capacity) {
static const int kDefaultBitrate = 200 * 1024 * 8; // 200 Kbps.
static const int kMaxBitrate = 20 * kMegabyte * 8; // 20 Mbps.
- static const float kMaxPlaybackRate = 25.0;
+ static const double kMaxPlaybackRate = 25.0;
static const int kTargetSecondsBufferedAhead = 10;
static const int kTargetSecondsBufferedBehind = 2;
@@ -71,12 +71,12 @@ static void ComputeTargetBufferWindow(float playback_rate, int bitrate,
// Only scale the buffer window for playback rates greater than 1.0 in
// magnitude and clamp to prevent overflow.
bool backward_playback = false;
- if (playback_rate < 0.0f) {
+ if (playback_rate < 0.0) {
backward_playback = true;
- playback_rate *= -1.0f;
+ playback_rate *= -1.0;
}
- playback_rate = std::max(playback_rate, 1.0f);
+ playback_rate = std::max(playback_rate, 1.0);
playback_rate = std::min(playback_rate, kMaxPlaybackRate);
int bytes_per_second = (bitrate / 8.0) * playback_rate;
@@ -101,7 +101,7 @@ BufferedResourceLoader::BufferedResourceLoader(
int64 last_byte_position,
DeferStrategy strategy,
int bitrate,
- float playback_rate,
+ double playback_rate,
MediaLog* media_log)
: buffer_(kMinBufferCapacity, kMinBufferCapacity),
loader_failed_(false),
@@ -571,7 +571,7 @@ void BufferedResourceLoader::UpdateDeferStrategy(DeferStrategy strategy) {
UpdateDeferBehavior();
}
-void BufferedResourceLoader::SetPlaybackRate(float playback_rate) {
+void BufferedResourceLoader::SetPlaybackRate(double playback_rate) {
playback_rate_ = playback_rate;
// This is a pause so don't bother updating the buffer window as we'll likely
« no previous file with comments | « media/blink/buffered_resource_loader.h ('k') | media/blink/buffered_resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698