| OLD | NEW |
| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. |
| 193 // |*instance_size| may be set to kPositionNotSpecified if the range ends in | 193 // |*instance_size| may be set to kPositionNotSpecified if the range ends in |
| 194 // "/*". | 194 // "/*". |
| 195 // NOTE: only public for testing! This is an implementation detail of | 195 // NOTE: only public for testing! This is an implementation detail of |
| 196 // VerifyPartialResponse (a private method). | 196 // VerifyPartialResponse (a private method). |
| 197 static bool ParseContentRange( | 197 static bool ParseContentRange( |
| 198 const std::string& content_range_str, int64* first_byte_position, | 198 const std::string& content_range_str, int64* first_byte_position, |
| 199 int64* last_byte_position, int64* instance_size); | 199 int64* last_byte_position, int64* instance_size); |
| 200 | 200 |
| 201 // Cancels and closes any outstanding deferred ActiveLoader instances. Does |
| 202 // not report a failed state, so subsequent read calls to cache may still |
| 203 // complete okay. If the ActiveLoader is not deferred it will be canceled once |
| 204 // it is unless playback starts before then (as determined by the reported |
| 205 // playback rate). |
| 206 void CancelUponDeferral(); |
| 207 |
| 201 private: | 208 private: |
| 202 friend class BufferedDataSourceTest; | 209 friend class BufferedDataSourceTest; |
| 203 friend class BufferedResourceLoaderTest; | 210 friend class BufferedResourceLoaderTest; |
| 204 friend class MockBufferedDataSource; | 211 friend class MockBufferedDataSource; |
| 205 | 212 |
| 206 // Updates the |buffer_|'s forward and backward capacities. | 213 // Updates the |buffer_|'s forward and backward capacities. |
| 207 void UpdateBufferWindow(); | 214 void UpdateBufferWindow(); |
| 208 | 215 |
| 209 // Updates deferring behavior based on current buffering scheme. | 216 // Updates deferring behavior based on current buffering scheme. |
| 210 void UpdateDeferBehavior(); | 217 void UpdateDeferBehavior(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 scoped_ptr<blink::WebURLLoader> test_loader_; | 311 scoped_ptr<blink::WebURLLoader> test_loader_; |
| 305 | 312 |
| 306 // Bitrate of the media. Set to 0 if unknown. | 313 // Bitrate of the media. Set to 0 if unknown. |
| 307 int bitrate_; | 314 int bitrate_; |
| 308 | 315 |
| 309 // Playback rate of the media. | 316 // Playback rate of the media. |
| 310 float playback_rate_; | 317 float playback_rate_; |
| 311 | 318 |
| 312 scoped_refptr<MediaLog> media_log_; | 319 scoped_refptr<MediaLog> media_log_; |
| 313 | 320 |
| 321 bool cancel_upon_deferral_; |
| 322 |
| 314 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); | 323 DISALLOW_COPY_AND_ASSIGN(BufferedResourceLoader); |
| 315 }; | 324 }; |
| 316 | 325 |
| 317 } // namespace media | 326 } // namespace media |
| 318 | 327 |
| 319 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ | 328 #endif // MEDIA_BLINK_BUFFERED_RESOURCE_LOADER_H_ |
| OLD | NEW |