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

Side by Side Diff: media/blink/buffered_resource_loader.h

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 unified diff | Download patch
« no previous file with comments | « media/blink/buffered_data_source_unittest.cc ('k') | media/blink/buffered_resource_loader.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 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 #ifndef MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ 5 #ifndef MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_
6 #define MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ 6 #define MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // |strategy| is the initial loading strategy to use. 78 // |strategy| is the initial loading strategy to use.
79 // |bitrate| is the bitrate of the media, 0 if unknown. 79 // |bitrate| is the bitrate of the media, 0 if unknown.
80 // |playback_rate| is the current playback rate of the media. 80 // |playback_rate| is the current playback rate of the media.
81 BufferedResourceLoader( 81 BufferedResourceLoader(
82 const GURL& url, 82 const GURL& url,
83 CORSMode cors_mode, 83 CORSMode cors_mode,
84 int64 first_byte_position, 84 int64 first_byte_position,
85 int64 last_byte_position, 85 int64 last_byte_position,
86 DeferStrategy strategy, 86 DeferStrategy strategy,
87 int bitrate, 87 int bitrate,
88 float playback_rate, 88 double playback_rate,
89 MediaLog* media_log); 89 MediaLog* media_log);
90 virtual ~BufferedResourceLoader(); 90 virtual ~BufferedResourceLoader();
91 91
92 // Start the resource loading with the specified URL and range. 92 // Start the resource loading with the specified URL and range.
93 // 93 //
94 // |loading_cb| is executed when the loading state has changed. 94 // |loading_cb| is executed when the loading state has changed.
95 // |progress_cb| is executed when additional data has arrived. 95 // |progress_cb| is executed when additional data has arrived.
96 typedef base::Callback<void(Status)> StartCB; 96 typedef base::Callback<void(Status)> StartCB;
97 typedef base::Callback<void(LoadingState)> LoadingStateChangedCB; 97 typedef base::Callback<void(LoadingState)> LoadingStateChangedCB;
98 typedef base::Callback<void(int64)> ProgressCB; 98 typedef base::Callback<void(int64)> ProgressCB;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool DidPassCORSAccessCheck() const; 172 bool DidPassCORSAccessCheck() const;
173 173
174 // Sets the defer strategy to the given value unless it seems unwise. 174 // Sets the defer strategy to the given value unless it seems unwise.
175 // Specifically downgrade kNeverDefer to kCapacityDefer if we know the 175 // Specifically downgrade kNeverDefer to kCapacityDefer if we know the
176 // current response will not be used to satisfy future requests (the cache 176 // current response will not be used to satisfy future requests (the cache
177 // won't help us). 177 // won't help us).
178 void UpdateDeferStrategy(DeferStrategy strategy); 178 void UpdateDeferStrategy(DeferStrategy strategy);
179 179
180 // Sets the playback rate to the given value and updates buffer window 180 // Sets the playback rate to the given value and updates buffer window
181 // accordingly. 181 // accordingly.
182 void SetPlaybackRate(float playback_rate); 182 void SetPlaybackRate(double playback_rate);
183 183
184 // Sets the bitrate to the given value and updates buffer window 184 // Sets the bitrate to the given value and updates buffer window
185 // accordingly. 185 // accordingly.
186 void SetBitrate(int bitrate); 186 void SetBitrate(int bitrate);
187 187
188 // Return the |first_byte_position| passed into the ctor. 188 // Return the |first_byte_position| passed into the ctor.
189 int64 first_byte_position() const; 189 int64 first_byte_position() const;
190 190
191 // Parse a Content-Range header into its component pieces and return true if 191 // Parse a Content-Range header into its component pieces and return true if
192 // each of the expected elements was found & parsed correctly. 192 // each of the expected elements was found & parsed correctly.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 int first_offset_; 307 int first_offset_;
308 int last_offset_; 308 int last_offset_;
309 309
310 // Injected WebURLLoader instance for testing purposes. 310 // Injected WebURLLoader instance for testing purposes.
311 scoped_ptr<blink::WebURLLoader> test_loader_; 311 scoped_ptr<blink::WebURLLoader> test_loader_;
312 312
313 // Bitrate of the media. Set to 0 if unknown. 313 // Bitrate of the media. Set to 0 if unknown.
314 int bitrate_; 314 int bitrate_;
315 315
316 // Playback rate of the media. 316 // Playback rate of the media.
317 float playback_rate_; 317 double playback_rate_;
318 318
319 scoped_refptr<MediaLog> media_log_; 319 scoped_refptr<MediaLog> media_log_;
320 320
321 bool cancel_upon_deferral_; 321 bool cancel_upon_deferral_;
322 322
323 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); 323 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader);
324 }; 324 };
325 325
326 } // namespace media 326 } // namespace media
327 327
328 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ 328 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_
OLDNEW
« no previous file with comments | « media/blink/buffered_data_source_unittest.cc ('k') | media/blink/buffered_resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698