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

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/SourceBuffer.h

Issue 2467233002: Remove "legacy" experimental stream support (Closed)
Patch Set: fix Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef SourceBuffer_h 31 #ifndef SourceBuffer_h
32 #define SourceBuffer_h 32 #define SourceBuffer_h
33 33
34 #include "bindings/core/v8/ActiveScriptWrappable.h" 34 #include "bindings/core/v8/ActiveScriptWrappable.h"
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/fileapi/FileReaderLoaderClient.h"
37 #include "modules/EventTargetModules.h" 36 #include "modules/EventTargetModules.h"
38 #include "modules/mediasource/TrackDefaultList.h" 37 #include "modules/mediasource/TrackDefaultList.h"
39 #include "platform/AsyncMethodRunner.h" 38 #include "platform/AsyncMethodRunner.h"
40 #include "platform/weborigin/KURL.h" 39 #include "platform/weborigin/KURL.h"
41 #include "public/platform/WebSourceBufferClient.h" 40 #include "public/platform/WebSourceBufferClient.h"
42 #include "wtf/text/WTFString.h" 41 #include "wtf/text/WTFString.h"
43 #include <memory> 42 #include <memory>
44 43
45 namespace blink { 44 namespace blink {
46 45
47 class AudioTrackList; 46 class AudioTrackList;
48 class DOMArrayBuffer; 47 class DOMArrayBuffer;
49 class DOMArrayBufferView; 48 class DOMArrayBufferView;
50 class ExceptionState; 49 class ExceptionState;
51 class FileReaderLoader;
52 class GenericEventQueue; 50 class GenericEventQueue;
53 class MediaSource; 51 class MediaSource;
54 class Stream;
55 class TimeRanges; 52 class TimeRanges;
56 class VideoTrackList; 53 class VideoTrackList;
57 class WebSourceBuffer; 54 class WebSourceBuffer;
58 55
59 class SourceBuffer final : public EventTargetWithInlineData, 56 class SourceBuffer final : public EventTargetWithInlineData,
60 public ActiveScriptWrappable, 57 public ActiveScriptWrappable,
61 public ActiveDOMObject, 58 public ActiveDOMObject,
62 public FileReaderLoaderClient,
63 public WebSourceBufferClient { 59 public WebSourceBufferClient {
64 USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); 60 USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer);
65 DEFINE_WRAPPERTYPEINFO(); 61 DEFINE_WRAPPERTYPEINFO();
66 USING_PRE_FINALIZER(SourceBuffer, dispose); 62 USING_PRE_FINALIZER(SourceBuffer, dispose);
67 63
68 public: 64 public:
69 static SourceBuffer* create(std::unique_ptr<WebSourceBuffer>, 65 static SourceBuffer* create(std::unique_ptr<WebSourceBuffer>,
70 MediaSource*, 66 MediaSource*,
71 GenericEventQueue*); 67 GenericEventQueue*);
72 static const AtomicString& segmentsKeyword(); 68 static const AtomicString& segmentsKeyword();
73 static const AtomicString& sequenceKeyword(); 69 static const AtomicString& sequenceKeyword();
74 70
75 ~SourceBuffer() override; 71 ~SourceBuffer() override;
76 72
77 // SourceBuffer.idl methods 73 // SourceBuffer.idl methods
78 const AtomicString& mode() const { return m_mode; } 74 const AtomicString& mode() const { return m_mode; }
79 void setMode(const AtomicString&, ExceptionState&); 75 void setMode(const AtomicString&, ExceptionState&);
80 bool updating() const { return m_updating; } 76 bool updating() const { return m_updating; }
81 TimeRanges* buffered(ExceptionState&) const; 77 TimeRanges* buffered(ExceptionState&) const;
82 double timestampOffset() const; 78 double timestampOffset() const;
83 void setTimestampOffset(double, ExceptionState&); 79 void setTimestampOffset(double, ExceptionState&);
84 void appendBuffer(DOMArrayBuffer* data, ExceptionState&); 80 void appendBuffer(DOMArrayBuffer* data, ExceptionState&);
85 void appendBuffer(DOMArrayBufferView* data, ExceptionState&); 81 void appendBuffer(DOMArrayBufferView* data, ExceptionState&);
86 void appendStream(Stream*, ExceptionState&);
87 void appendStream(Stream*, unsigned long long maxSize, ExceptionState&);
88 void abort(ExceptionState&); 82 void abort(ExceptionState&);
89 void remove(double start, double end, ExceptionState&); 83 void remove(double start, double end, ExceptionState&);
90 double appendWindowStart() const; 84 double appendWindowStart() const;
91 void setAppendWindowStart(double, ExceptionState&); 85 void setAppendWindowStart(double, ExceptionState&);
92 double appendWindowEnd() const; 86 double appendWindowEnd() const;
93 void setAppendWindowEnd(double, ExceptionState&); 87 void setAppendWindowEnd(double, ExceptionState&);
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(updatestart); 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(updatestart);
95 DEFINE_ATTRIBUTE_EVENT_LISTENER(update); 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(update);
96 DEFINE_ATTRIBUTE_EVENT_LISTENER(updateend); 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(updateend);
97 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
(...skipping 18 matching lines...) Expand all
116 // EventTarget interface 110 // EventTarget interface
117 ExecutionContext* getExecutionContext() const override; 111 ExecutionContext* getExecutionContext() const override;
118 const AtomicString& interfaceName() const override; 112 const AtomicString& interfaceName() const override;
119 113
120 // WebSourceBufferClient interface 114 // WebSourceBufferClient interface
121 bool initializationSegmentReceived(const WebVector<MediaTrackInfo>&) override; 115 bool initializationSegmentReceived(const WebVector<MediaTrackInfo>&) override;
122 116
123 DECLARE_VIRTUAL_TRACE(); 117 DECLARE_VIRTUAL_TRACE();
124 118
125 private: 119 private:
126 enum AppendStreamDoneAction { 120 enum AppendStreamDoneAction {
wolenetz 2016/11/07 19:42:00 Please also remove this enum. It was only used in
127 NoError, 121 NoError,
128 RunAppendErrorWithNoDecodeError, 122 RunAppendErrorWithNoDecodeError,
129 RunAppendErrorWithDecodeError 123 RunAppendErrorWithDecodeError
130 }; 124 };
131 125
132 enum AppendError { NoDecodeError, DecodeError }; 126 enum AppendError { NoDecodeError, DecodeError };
133 127
134 SourceBuffer(std::unique_ptr<WebSourceBuffer>, 128 SourceBuffer(std::unique_ptr<WebSourceBuffer>,
135 MediaSource*, 129 MediaSource*,
136 GenericEventQueue*); 130 GenericEventQueue*);
137 void dispose(); 131 void dispose();
138 132
139 bool isRemoved() const; 133 bool isRemoved() const;
140 void scheduleEvent(const AtomicString& eventName); 134 void scheduleEvent(const AtomicString& eventName);
141 135
142 bool prepareAppend(size_t newDataSize, ExceptionState&); 136 bool prepareAppend(size_t newDataSize, ExceptionState&);
143 bool evictCodedFrames(size_t newDataSize); 137 bool evictCodedFrames(size_t newDataSize);
144 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); 138 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&);
145 void appendBufferAsyncPart(); 139 void appendBufferAsyncPart();
146 void appendError(AppendError); 140 void appendError(AppendError);
147 141
148 void removeAsyncPart(); 142 void removeAsyncPart();
149 143
150 void appendStreamInternal(Stream*, ExceptionState&);
151 void appendStreamAsyncPart();
152 void appendStreamDone(AppendStreamDoneAction);
153 void clearAppendStreamState();
154
155 void cancelRemove(); 144 void cancelRemove();
156 void abortIfUpdating(); 145 void abortIfUpdating();
157 146
158 void removeMediaTracks(); 147 void removeMediaTracks();
159 148
160 const TrackDefault* getTrackDefault( 149 const TrackDefault* getTrackDefault(
161 const AtomicString& trackType, 150 const AtomicString& trackType,
162 const AtomicString& byteStreamTrackID) const; 151 const AtomicString& byteStreamTrackID) const;
163 AtomicString defaultTrackLabel(const AtomicString& trackType, 152 AtomicString defaultTrackLabel(const AtomicString& trackType,
164 const AtomicString& byteStreamTrackID) const; 153 const AtomicString& byteStreamTrackID) const;
165 AtomicString defaultTrackLanguage( 154 AtomicString defaultTrackLanguage(
166 const AtomicString& trackType, 155 const AtomicString& trackType,
167 const AtomicString& byteStreamTrackID) const; 156 const AtomicString& byteStreamTrackID) const;
168 157
169 // FileReaderLoaderClient interface
170 void didStartLoading() override;
171 void didReceiveDataForClient(const char* data, unsigned dataLength) override;
172 void didFinishLoading() override;
173 void didFail(FileError::ErrorCode) override;
174
175 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; 158 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer;
176 Member<MediaSource> m_source; 159 Member<MediaSource> m_source;
177 Member<TrackDefaultList> m_trackDefaults; 160 Member<TrackDefaultList> m_trackDefaults;
178 Member<GenericEventQueue> m_asyncEventQueue; 161 Member<GenericEventQueue> m_asyncEventQueue;
179 162
180 AtomicString m_mode; 163 AtomicString m_mode;
181 bool m_updating; 164 bool m_updating;
182 double m_timestampOffset; 165 double m_timestampOffset;
183 Member<AudioTrackList> m_audioTracks; 166 Member<AudioTrackList> m_audioTracks;
184 Member<VideoTrackList> m_videoTracks; 167 Member<VideoTrackList> m_videoTracks;
185 double m_appendWindowStart; 168 double m_appendWindowStart;
186 double m_appendWindowEnd; 169 double m_appendWindowEnd;
187 bool m_firstInitializationSegmentReceived; 170 bool m_firstInitializationSegmentReceived;
188 171
189 Vector<unsigned char> m_pendingAppendData; 172 Vector<unsigned char> m_pendingAppendData;
190 size_t m_pendingAppendDataOffset; 173 size_t m_pendingAppendDataOffset;
191 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; 174 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner;
192 175
193 double m_pendingRemoveStart; 176 double m_pendingRemoveStart;
194 double m_pendingRemoveEnd; 177 double m_pendingRemoveEnd;
195 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; 178 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner;
196
197 bool m_streamMaxSizeValid;
198 unsigned long long m_streamMaxSize;
199 Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner;
200 Member<Stream> m_stream;
201 std::unique_ptr<FileReaderLoader> m_loader;
202 }; 179 };
203 180
204 } // namespace blink 181 } // namespace blink
205 182
206 #endif // SourceBuffer_h 183 #endif // SourceBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698