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 CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ |
6 #define CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // from the demuxer. The caller is expected to release its reference to this | 85 // from the demuxer. The caller is expected to release its reference to this |
86 // object and never call it again. | 86 // object and never call it again. |
87 // | 87 // |
88 // Method called on the render thread. | 88 // Method called on the render thread. |
89 void Abort(); | 89 void Abort(); |
90 | 90 |
91 // Notifies changes in playback state for controlling media buffering | 91 // Notifies changes in playback state for controlling media buffering |
92 // behavior. | 92 // behavior. |
93 void MediaPlaybackRateChanged(float playback_rate); | 93 void MediaPlaybackRateChanged(float playback_rate); |
94 void MediaIsPlaying(); | 94 void MediaIsPlaying(); |
95 void MediaIsPaused(); | 95 void MediaIsPaused(bool is_local_resource); |
96 | 96 |
97 // media::DataSource implementation. | 97 // media::DataSource implementation. |
98 // Called from demuxer thread. | 98 // Called from demuxer thread. |
99 virtual void Stop(const base::Closure& closure) OVERRIDE; | 99 virtual void Stop(const base::Closure& closure) OVERRIDE; |
100 | 100 |
101 virtual void Read(int64 position, int size, uint8* data, | 101 virtual void Read(int64 position, int size, uint8* data, |
102 const media::DataSource::ReadCB& read_cb) OVERRIDE; | 102 const media::DataSource::ReadCB& read_cb) OVERRIDE; |
103 virtual bool GetSize(int64* size_out) OVERRIDE; | 103 virtual bool GetSize(int64* size_out) OVERRIDE; |
104 virtual bool IsStreaming() OVERRIDE; | 104 virtual bool IsStreaming() OVERRIDE; |
105 virtual void SetBitrate(int bitrate) OVERRIDE; | 105 virtual void SetBitrate(int bitrate) OVERRIDE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // when accessing ranges that are outside initial buffered region). | 138 // when accessing ranges that are outside initial buffered region). |
139 void PartialReadStartCallback(BufferedResourceLoader::Status status); | 139 void PartialReadStartCallback(BufferedResourceLoader::Status status); |
140 | 140 |
141 // BufferedResourceLoader callbacks. | 141 // BufferedResourceLoader callbacks. |
142 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); | 142 void ReadCallback(BufferedResourceLoader::Status status, int bytes_read); |
143 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); | 143 void LoadingStateChangedCallback(BufferedResourceLoader::LoadingState state); |
144 void ProgressCallback(int64 position); | 144 void ProgressCallback(int64 position); |
145 | 145 |
146 // Update |loader_|'s deferring strategy in response to a play/pause, or | 146 // Update |loader_|'s deferring strategy in response to a play/pause, or |
147 // change in playback rate. | 147 // change in playback rate. |
148 void UpdateDeferStrategy(bool paused); | 148 void UpdateDeferStrategy(bool paused, bool is_local_resource); |
149 | 149 |
150 // URL of the resource requested. | 150 // URL of the resource requested. |
151 GURL url_; | 151 GURL url_; |
152 // crossorigin attribute on the corresponding HTML media element, if any. | 152 // crossorigin attribute on the corresponding HTML media element, if any. |
153 BufferedResourceLoader::CORSMode cors_mode_; | 153 BufferedResourceLoader::CORSMode cors_mode_; |
154 | 154 |
155 // The total size of the resource. Set during StartCallback() if the size is | 155 // The total size of the resource. Set during StartCallback() if the size is |
156 // known, otherwise it will remain kPositionNotSpecified until the size is | 156 // known, otherwise it will remain kPositionNotSpecified until the size is |
157 // determined by reaching EOF. | 157 // determined by reaching EOF. |
158 int64 total_bytes_; | 158 int64 total_bytes_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 // NOTE: Weak pointers must be invalidated before all other member variables. | 225 // NOTE: Weak pointers must be invalidated before all other member variables. |
226 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 226 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
227 | 227 |
228 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 228 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
229 }; | 229 }; |
230 | 230 |
231 } // namespace content | 231 } // namespace content |
232 | 232 |
233 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ | 233 #endif // CONTENT_RENDERER_MEDIA_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |