Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: media/blink/buffered_data_source.h

Issue 1815893002: Merge M50: "Disable "pause-and-buffer" on Android, cancel suspended players." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/blink/buffered_data_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // Notifies changes in playback state for controlling media buffering 99 // Notifies changes in playback state for controlling media buffering
100 // behavior. 100 // behavior.
101 virtual void MediaPlaybackRateChanged(double playback_rate) = 0; 101 virtual void MediaPlaybackRateChanged(double playback_rate) = 0;
102 virtual void MediaIsPlaying() = 0; 102 virtual void MediaIsPlaying() = 0;
103 virtual bool media_has_played() const = 0; 103 virtual bool media_has_played() const = 0;
104 104
105 // Returns true if the resource is local. 105 // Returns true if the resource is local.
106 virtual bool assume_fully_buffered() = 0; 106 virtual bool assume_fully_buffered() = 0;
107 107
108 // Cancels any open network connections once reaching the deferred state for 108 // Cancels any open network connections once reaching the deferred state. If
109 // preload=metadata, non-streaming resources that have not started playback. 109 // |always_cancel| is false this is done only for preload=metadata, non-
110 // If already deferred, connections will be immediately closed. 110 // streaming resources that have not started playback. If |always_cancel| is
111 virtual void OnBufferingHaveEnough() = 0; 111 // true, all resource types will have their connections canceled. If already
112 // deferred, connections will be immediately closed.
113 virtual void OnBufferingHaveEnough(bool always_cancel) = 0;
112 114
113 // Returns an estimate of the number of bytes held by the data source. 115 // Returns an estimate of the number of bytes held by the data source.
114 virtual int64_t GetMemoryUsage() const = 0; 116 virtual int64_t GetMemoryUsage() const = 0;
115 }; 117 };
116 118
117 // A data source capable of loading URLs and buffering the data using an 119 // A data source capable of loading URLs and buffering the data using an
118 // in-memory sliding window. 120 // in-memory sliding window.
119 // 121 //
120 // BufferedDataSource must be created and destroyed on the thread associated 122 // BufferedDataSource must be created and destroyed on the thread associated
121 // with the |task_runner| passed in the constructor. 123 // with the |task_runner| passed in the constructor.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 173
172 // Notifies changes in playback state for controlling media buffering 174 // Notifies changes in playback state for controlling media buffering
173 // behavior. 175 // behavior.
174 void MediaPlaybackRateChanged(double playback_rate) override; 176 void MediaPlaybackRateChanged(double playback_rate) override;
175 void MediaIsPlaying() override; 177 void MediaIsPlaying() override;
176 bool media_has_played() const override; 178 bool media_has_played() const override;
177 179
178 // Returns true if the resource is local. 180 // Returns true if the resource is local.
179 bool assume_fully_buffered() override; 181 bool assume_fully_buffered() override;
180 182
181 // Cancels any open network connections once reaching the deferred state for 183 // Cancels any open network connections once reaching the deferred state. If
182 // preload=metadata, non-streaming resources that have not started playback. 184 // |always_cancel| is false this is done only for preload=metadata, non-
183 // If already deferred, connections will be immediately closed. 185 // streaming resources that have not started playback. If |always_cancel| is
184 void OnBufferingHaveEnough() override; 186 // true, all resource types will have their connections canceled. If already
187 // deferred, connections will be immediately closed.
188 void OnBufferingHaveEnough(bool always_cancel) override;
185 189
186 // Returns an estimate of the number of bytes held by the data source. 190 // Returns an estimate of the number of bytes held by the data source.
187 int64_t GetMemoryUsage() const override; 191 int64_t GetMemoryUsage() const override;
188 192
189 // DataSource implementation. 193 // DataSource implementation.
190 // Called from demuxer thread. 194 // Called from demuxer thread.
191 void Stop() override; 195 void Stop() override;
192 196
193 void Read(int64_t position, 197 void Read(int64_t position,
194 int size, 198 int size,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // reaching into this class from multiple threads to attain a WeakPtr. 333 // reaching into this class from multiple threads to attain a WeakPtr.
330 base::WeakPtr<BufferedDataSource> weak_ptr_; 334 base::WeakPtr<BufferedDataSource> weak_ptr_;
331 base::WeakPtrFactory<BufferedDataSource> weak_factory_; 335 base::WeakPtrFactory<BufferedDataSource> weak_factory_;
332 336
333 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource); 337 DISALLOW_COPY_AND_ASSIGN(BufferedDataSource);
334 }; 338 };
335 339
336 } // namespace media 340 } // namespace media
337 341
338 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_ 342 #endif // MEDIA_BLINK_BUFFERED_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | media/blink/buffered_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698