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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // will be reported to |host|. |downloading_cb| will be called whenever the | 63 // will be reported to |host|. |downloading_cb| will be called whenever the |
64 // downloading/paused state of the source changes. | 64 // downloading/paused state of the source changes. |
65 BufferedDataSource( | 65 BufferedDataSource( |
66 const GURL& url, | 66 const GURL& url, |
67 BufferedResourceLoader::CORSMode cors_mode, | 67 BufferedResourceLoader::CORSMode cors_mode, |
68 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 68 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
69 blink::WebFrame* frame, | 69 blink::WebFrame* frame, |
70 MediaLog* media_log, | 70 MediaLog* media_log, |
71 BufferedDataSourceHost* host, | 71 BufferedDataSourceHost* host, |
72 const DownloadingCB& downloading_cb); | 72 const DownloadingCB& downloading_cb); |
73 virtual ~BufferedDataSource(); | 73 ~BufferedDataSource() override; |
74 | 74 |
75 // Executes |init_cb| with the result of initialization when it has completed. | 75 // Executes |init_cb| with the result of initialization when it has completed. |
76 // | 76 // |
77 // Method called on the render thread. | 77 // Method called on the render thread. |
78 typedef base::Callback<void(bool)> InitializeCB; | 78 typedef base::Callback<void(bool)> InitializeCB; |
79 void Initialize(const InitializeCB& init_cb); | 79 void Initialize(const InitializeCB& init_cb); |
80 | 80 |
81 // Adjusts the buffering algorithm based on the given preload value. | 81 // Adjusts the buffering algorithm based on the given preload value. |
82 void SetPreload(Preload preload); | 82 void SetPreload(Preload preload); |
83 | 83 |
(...skipping 17 matching lines...) Expand all Loading... |
101 // behavior. | 101 // behavior. |
102 void MediaPlaybackRateChanged(float playback_rate); | 102 void MediaPlaybackRateChanged(float playback_rate); |
103 void MediaIsPlaying(); | 103 void MediaIsPlaying(); |
104 void MediaIsPaused(); | 104 void MediaIsPaused(); |
105 | 105 |
106 // Returns true if the resource is local. | 106 // Returns true if the resource is local. |
107 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } | 107 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } |
108 | 108 |
109 // DataSource implementation. | 109 // DataSource implementation. |
110 // Called from demuxer thread. | 110 // Called from demuxer thread. |
111 virtual void Stop() override; | 111 void Stop() override; |
112 | 112 |
113 virtual void Read(int64 position, int size, uint8* data, | 113 void Read(int64 position, |
114 const DataSource::ReadCB& read_cb) override; | 114 int size, |
115 virtual bool GetSize(int64* size_out) override; | 115 uint8* data, |
116 virtual bool IsStreaming() override; | 116 const DataSource::ReadCB& read_cb) override; |
117 virtual void SetBitrate(int bitrate) override; | 117 bool GetSize(int64* size_out) override; |
| 118 bool IsStreaming() override; |
| 119 void SetBitrate(int bitrate) override; |
118 | 120 |
119 protected: | 121 protected: |
120 // A factory method to create a BufferedResourceLoader based on the read | 122 // A factory method to create a BufferedResourceLoader based on the read |
121 // parameters. We can override this file to object a mock | 123 // parameters. We can override this file to object a mock |
122 // BufferedResourceLoader for testing. | 124 // BufferedResourceLoader for testing. |
123 virtual BufferedResourceLoader* CreateResourceLoader( | 125 virtual BufferedResourceLoader* CreateResourceLoader( |
124 int64 first_byte_position, int64 last_byte_position); | 126 int64 first_byte_position, int64 last_byte_position); |
125 | 127 |
126 private: | 128 private: |
127 friend class BufferedDataSourceTest; | 129 friend class BufferedDataSourceTest; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 233 |
232 // NOTE: Weak pointers must be invalidated before all other member variables. | 234 // NOTE: Weak pointers must be invalidated before all other member variables. |
233 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 235 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
234 | 236 |
235 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 237 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
236 }; | 238 }; |
237 | 239 |
238 } // namespace media | 240 } // namespace media |
239 | 241 |
240 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 242 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |