Chromium Code Reviews| 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_DATA_SOURCE_H_ | 5 #ifndef MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 6 #define MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 namespace media { | 23 namespace media { |
| 24 class MediaLog; | 24 class MediaLog; |
| 25 | 25 |
| 26 class MEDIA_EXPORT BufferedDataSourceHost { | 26 class MEDIA_EXPORT BufferedDataSourceHost { |
| 27 public: | 27 public: |
| 28 // Notify the host of the total size of the media file. | 28 // Notify the host of the total size of the media file. |
| 29 virtual void SetTotalBytes(int64 total_bytes) = 0; | 29 virtual void SetTotalBytes(int64 total_bytes) = 0; |
| 30 | 30 |
| 31 // Notify the host that byte range [start,end] has been buffered. | 31 // Notify the host that byte range [start,end] has been buffered. |
| 32 // TODO(fischman): remove this method when demuxing is push-based instead of | |
| 33 // pull-based. http://crbug.com/131444 | |
|
scherkus (not reviewing)
2014/09/17 16:25:28
while http://crbug.com/131444 has been closed as W
| |
| 34 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; | 32 virtual void AddBufferedByteRange(int64 start, int64 end) = 0; |
| 35 | 33 |
| 34 // Notify the host that byte range [0, end) has been evicted. | |
| 35 virtual void RemoveBufferedByteRange(int64 end) = 0; | |
| 36 | |
| 36 protected: | 37 protected: |
| 37 virtual ~BufferedDataSourceHost() {}; | 38 virtual ~BufferedDataSourceHost() {}; |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 // A data source capable of loading URLs and buffering the data using an | 41 // A data source capable of loading URLs and buffering the data using an |
| 41 // in-memory sliding window. | 42 // in-memory sliding window. |
| 42 // | 43 // |
| 43 // BufferedDataSource must be created and initialized on the render thread | 44 // BufferedDataSource must be created and initialized on the render thread |
| 44 // before being passed to other threads. It may be deleted on any thread. | 45 // before being passed to other threads. It may be deleted on any thread. |
| 45 class MEDIA_EXPORT BufferedDataSource : public DataSource { | 46 class MEDIA_EXPORT BufferedDataSource : public DataSource { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 // BufferedResourceLoader::Start() callback for initial load. | 146 // BufferedResourceLoader::Start() callback for initial load. |
| 146 void StartCallback(BufferedResourceLoader::Status status); | 147 void StartCallback(BufferedResourceLoader::Status status); |
| 147 | 148 |
| 148 // BufferedResourceLoader::Start() callback for subsequent loads (i.e., | 149 // BufferedResourceLoader::Start() callback for subsequent loads (i.e., |
| 149 // when accessing ranges that are outside initial buffered region). | 150 // when accessing ranges that are outside initial buffered region). |
| 150 void PartialReadStartCallback(BufferedResourceLoader::Status status); | 151 void PartialReadStartCallback(BufferedResourceLoader::Status status); |
| 151 | 152 |
| 152 // BufferedResourceLoader callbacks. | 153 // BufferedResourceLoader callbacks. |
| 153 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); | 154 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); |
| 154 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); | 155 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); |
| 155 void ProgressCallback(int64 position); | 156 void ProgressCallback(int64 earliest_position, int64 position); |
| 156 | 157 |
| 157 // Update |loader_|'s deferring strategy in response to a play/pause, or | 158 // Update |loader_|'s deferring strategy in response to a play/pause, or |
| 158 // change in playback rate. | 159 // change in playback rate. |
| 159 void UpdateDeferStrategy(bool paused); | 160 void UpdateDeferStrategy(bool paused); |
| 160 | 161 |
| 161 // URL of the resource requested. | 162 // URL of the resource requested. |
| 162 GURL url_; | 163 GURL url_; |
| 163 // crossorigin attribute on the corresponding HTML media element, if any. | 164 // crossorigin attribute on the corresponding HTML media element, if any. |
| 164 BufferedResourceLoader::CORSMode cors_mode_; | 165 BufferedResourceLoader::CORSMode cors_mode_; |
| 165 | 166 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 | 232 |
| 232 // NOTE: Weak pointers must be invalidated before all other member variables. | 233 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 233 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 234 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
| 234 | 235 |
| 235 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 236 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
| 236 }; | 237 }; |
| 237 | 238 |
| 238 } // namespace media | 239 } // namespace media |
| 239 | 240 |
| 240 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 241 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
| OLD | NEW |