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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool media_has_played() const { return media_has_played_; } | 106 bool media_has_played() const { return media_has_played_; } |
107 | 107 |
108 // Returns true if the resource is local. | 108 // Returns true if the resource is local. |
109 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } | 109 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } |
110 | 110 |
111 // Cancels any open network connections once reaching the deferred state for | 111 // Cancels any open network connections once reaching the deferred state for |
112 // preload=metadata, non-streaming resources that have not started playback. | 112 // preload=metadata, non-streaming resources that have not started playback. |
113 // If already deferred, connections will be immediately closed. | 113 // If already deferred, connections will be immediately closed. |
114 void OnBufferingHaveEnough(); | 114 void OnBufferingHaveEnough(); |
115 | 115 |
| 116 // Returns an estimate of the number of bytes held by the data source. |
| 117 int64_t GetMemoryUsage() const; |
| 118 |
116 // DataSource implementation. | 119 // DataSource implementation. |
117 // Called from demuxer thread. | 120 // Called from demuxer thread. |
118 void Stop() override; | 121 void Stop() override; |
119 | 122 |
120 void Read(int64 position, | 123 void Read(int64 position, |
121 int size, | 124 int size, |
122 uint8* data, | 125 uint8* data, |
123 const DataSource::ReadCB& read_cb) override; | 126 const DataSource::ReadCB& read_cb) override; |
124 bool GetSize(int64* size_out) override; | 127 bool GetSize(int64* size_out) override; |
125 bool IsStreaming() override; | 128 bool IsStreaming() override; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // reaching into this class from multiple threads to attain a WeakPtr. | 256 // reaching into this class from multiple threads to attain a WeakPtr. |
254 base::WeakPtr<BufferedDataSource> weak_ptr_; | 257 base::WeakPtr<BufferedDataSource> weak_ptr_; |
255 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 258 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
256 | 259 |
257 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 260 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
258 }; | 261 }; |
259 | 262 |
260 } // namespace media | 263 } // namespace media |
261 | 264 |
262 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 265 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |