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

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 {
127 NoError,
128 RunAppendErrorWithNoDecodeError,
129 RunAppendErrorWithDecodeError
130 };
131
132 enum AppendError { NoDecodeError, DecodeError }; 120 enum AppendError { NoDecodeError, DecodeError };
133 121
134 SourceBuffer(std::unique_ptr<WebSourceBuffer>, 122 SourceBuffer(std::unique_ptr<WebSourceBuffer>,
135 MediaSource*, 123 MediaSource*,
136 GenericEventQueue*); 124 GenericEventQueue*);
137 void dispose(); 125 void dispose();
138 126
139 bool isRemoved() const; 127 bool isRemoved() const;
140 void scheduleEvent(const AtomicString& eventName); 128 void scheduleEvent(const AtomicString& eventName);
141 129
142 bool prepareAppend(size_t newDataSize, ExceptionState&); 130 bool prepareAppend(size_t newDataSize, ExceptionState&);
143 bool evictCodedFrames(size_t newDataSize); 131 bool evictCodedFrames(size_t newDataSize);
144 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); 132 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&);
145 void appendBufferAsyncPart(); 133 void appendBufferAsyncPart();
146 void appendError(AppendError); 134 void appendError(AppendError);
147 135
148 void removeAsyncPart(); 136 void removeAsyncPart();
149 137
150 void appendStreamInternal(Stream*, ExceptionState&);
151 void appendStreamAsyncPart();
152 void appendStreamDone(AppendStreamDoneAction);
153 void clearAppendStreamState();
154
155 void cancelRemove(); 138 void cancelRemove();
156 void abortIfUpdating(); 139 void abortIfUpdating();
157 140
158 void removeMediaTracks(); 141 void removeMediaTracks();
159 142
160 const TrackDefault* getTrackDefault( 143 const TrackDefault* getTrackDefault(
161 const AtomicString& trackType, 144 const AtomicString& trackType,
162 const AtomicString& byteStreamTrackID) const; 145 const AtomicString& byteStreamTrackID) const;
163 AtomicString defaultTrackLabel(const AtomicString& trackType, 146 AtomicString defaultTrackLabel(const AtomicString& trackType,
164 const AtomicString& byteStreamTrackID) const; 147 const AtomicString& byteStreamTrackID) const;
165 AtomicString defaultTrackLanguage( 148 AtomicString defaultTrackLanguage(
166 const AtomicString& trackType, 149 const AtomicString& trackType,
167 const AtomicString& byteStreamTrackID) const; 150 const AtomicString& byteStreamTrackID) const;
168 151
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; 152 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer;
176 Member<MediaSource> m_source; 153 Member<MediaSource> m_source;
177 Member<TrackDefaultList> m_trackDefaults; 154 Member<TrackDefaultList> m_trackDefaults;
178 Member<GenericEventQueue> m_asyncEventQueue; 155 Member<GenericEventQueue> m_asyncEventQueue;
179 156
180 AtomicString m_mode; 157 AtomicString m_mode;
181 bool m_updating; 158 bool m_updating;
182 double m_timestampOffset; 159 double m_timestampOffset;
183 Member<AudioTrackList> m_audioTracks; 160 Member<AudioTrackList> m_audioTracks;
184 Member<VideoTrackList> m_videoTracks; 161 Member<VideoTrackList> m_videoTracks;
185 double m_appendWindowStart; 162 double m_appendWindowStart;
186 double m_appendWindowEnd; 163 double m_appendWindowEnd;
187 bool m_firstInitializationSegmentReceived; 164 bool m_firstInitializationSegmentReceived;
188 165
189 Vector<unsigned char> m_pendingAppendData; 166 Vector<unsigned char> m_pendingAppendData;
190 size_t m_pendingAppendDataOffset; 167 size_t m_pendingAppendDataOffset;
191 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; 168 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner;
192 169
193 double m_pendingRemoveStart; 170 double m_pendingRemoveStart;
194 double m_pendingRemoveEnd; 171 double m_pendingRemoveEnd;
195 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; 172 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 }; 173 };
203 174
204 } // namespace blink 175 } // namespace blink
205 176
206 #endif // SourceBuffer_h 177 #endif // SourceBuffer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698