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

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

Issue 2267963002: Add support for cancellation of demuxer reads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add tests. Created 4 years, 3 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 | « media/base/pipeline_impl_unittest.cc ('k') | media/blink/multibuffer_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_MULTIBUFFER_DATA_SOURCE_H_ 5 #ifndef MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
6 #define MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_ 6 #define MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // Returns true if the media resource has a single origin, false otherwise. 91 // Returns true if the media resource has a single origin, false otherwise.
92 // Only valid to call after Initialize() has completed. 92 // Only valid to call after Initialize() has completed.
93 // 93 //
94 // Method called on the render thread. 94 // Method called on the render thread.
95 bool HasSingleOrigin(); 95 bool HasSingleOrigin();
96 96
97 // Returns true if the media resource passed a CORS access control check. 97 // Returns true if the media resource passed a CORS access control check.
98 bool DidPassCORSAccessCheck() const; 98 bool DidPassCORSAccessCheck() const;
99 99
100 // Cancels initialization, any pending loaders, and any pending read calls
101 // from the demuxer. The caller is expected to release its reference to this
102 // object and never call it again.
103 //
104 // Method called on the render thread.
105 void Abort();
106
107 // Notifies changes in playback state for controlling media buffering 100 // Notifies changes in playback state for controlling media buffering
108 // behavior. 101 // behavior.
109 void MediaPlaybackRateChanged(double playback_rate); 102 void MediaPlaybackRateChanged(double playback_rate);
110 void MediaIsPlaying(); 103 void MediaIsPlaying();
111 bool media_has_played() const; 104 bool media_has_played() const;
112 105
113 // Returns true if the resource is local. 106 // Returns true if the resource is local.
114 bool assume_fully_buffered(); 107 bool assume_fully_buffered();
115 108
116 // Cancels any open network connections once reaching the deferred state. If 109 // Cancels any open network connections once reaching the deferred state. If
117 // |always_cancel| is false this is done only for preload=metadata, non- 110 // |always_cancel| is false this is done only for preload=metadata, non-
118 // streaming resources that have not started playback. If |always_cancel| is 111 // streaming resources that have not started playback. If |always_cancel| is
119 // true, all resource types will have their connections canceled. If already 112 // true, all resource types will have their connections canceled. If already
120 // deferred, connections will be immediately closed. 113 // deferred, connections will be immediately closed.
121 void OnBufferingHaveEnough(bool always_cancel); 114 void OnBufferingHaveEnough(bool always_cancel);
122 115
123 int64_t GetMemoryUsage() const; 116 int64_t GetMemoryUsage() const;
124 117
125 GURL GetUrlAfterRedirects() const; 118 GURL GetUrlAfterRedirects() const;
126 119
127 // DataSource implementation. 120 // DataSource implementation.
128 // Called from demuxer thread. 121 // Called from demuxer thread.
129 void Stop() override; 122 void Stop() override;
123 void Abort() override;
130 124
131 void Read(int64_t position, 125 void Read(int64_t position,
132 int size, 126 int size,
133 uint8_t* data, 127 uint8_t* data,
134 const DataSource::ReadCB& read_cb) override; 128 const DataSource::ReadCB& read_cb) override;
135 bool GetSize(int64_t* size_out) override; 129 bool GetSize(int64_t* size_out) override;
136 bool IsStreaming() override; 130 bool IsStreaming() override;
137 void SetBitrate(int bitrate) override; 131 void SetBitrate(int bitrate) override;
138 132
139 protected: 133 protected:
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // reaching into this class from multiple threads to attain a WeakPtr. 262 // reaching into this class from multiple threads to attain a WeakPtr.
269 base::WeakPtr<MultibufferDataSource> weak_ptr_; 263 base::WeakPtr<MultibufferDataSource> weak_ptr_;
270 base::WeakPtrFactory<MultibufferDataSource> weak_factory_; 264 base::WeakPtrFactory<MultibufferDataSource> weak_factory_;
271 265
272 DISALLOW_COPY_AND_ASSIGN(MultibufferDataSource); 266 DISALLOW_COPY_AND_ASSIGN(MultibufferDataSource);
273 }; 267 };
274 268
275 } // namespace media 269 } // namespace media
276 270
277 #endif // MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_ 271 #endif // MEDIA_BLINK_MULTIBUFFER_DATA_SOURCE_H_
OLDNEW
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | media/blink/multibuffer_data_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698