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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // object and never call it again. | 96 // object and never call it again. |
97 // | 97 // |
98 // Method called on the render thread. | 98 // Method called on the render thread. |
99 void Abort(); | 99 void Abort(); |
100 | 100 |
101 // Notifies changes in playback state for controlling media buffering | 101 // Notifies changes in playback state for controlling media buffering |
102 // behavior. | 102 // behavior. |
103 void MediaPlaybackRateChanged(float playback_rate); | 103 void MediaPlaybackRateChanged(float playback_rate); |
104 void MediaIsPlaying(); | 104 void MediaIsPlaying(); |
105 void MediaIsPaused(); | 105 void MediaIsPaused(); |
| 106 bool media_has_played() const { return media_has_played_; } |
106 | 107 |
107 // Returns true if the resource is local. | 108 // Returns true if the resource is local. |
108 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } | 109 bool assume_fully_buffered() { return !url_.SchemeIsHTTPOrHTTPS(); } |
109 | 110 |
| 111 // Cancels any open network connections once reaching the deferred state for |
| 112 // preload=metadata, non-streaming resources that have not started playback. |
| 113 // If already deferred, connections will be immediately closed. |
| 114 void OnBufferingHaveEnough(); |
| 115 |
110 // DataSource implementation. | 116 // DataSource implementation. |
111 // Called from demuxer thread. | 117 // Called from demuxer thread. |
112 void Stop() override; | 118 void Stop() override; |
113 | 119 |
114 void Read(int64 position, | 120 void Read(int64 position, |
115 int size, | 121 int size, |
116 uint8* data, | 122 uint8* data, |
117 const DataSource::ReadCB& read_cb) override; | 123 const DataSource::ReadCB& read_cb) override; |
118 bool GetSize(int64* size_out) override; | 124 bool GetSize(int64* size_out) override; |
119 bool IsStreaming() override; | 125 bool IsStreaming() override; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // reaching into this class from multiple threads to attain a WeakPtr. | 243 // reaching into this class from multiple threads to attain a WeakPtr. |
238 base::WeakPtr<BufferedDataSource> weak_ptr_; | 244 base::WeakPtr<BufferedDataSource> weak_ptr_; |
239 base::WeakPtrFactory<BufferedDataSource> weak_factory_; | 245 base::WeakPtrFactory<BufferedDataSource> weak_factory_; |
240 | 246 |
241 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); | 247 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); |
242 }; | 248 }; |
243 | 249 |
244 } // namespace media | 250 } // namespace media |
245 | 251 |
246 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ | 252 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ |
OLD | NEW |