OLD | NEW |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // ActiveDOMObject interface | 104 // ActiveDOMObject interface |
105 void suspend() override; | 105 void suspend() override; |
106 void resume() override; | 106 void resume() override; |
107 void stop() override; | 107 void stop() override; |
108 | 108 |
109 // EventTarget interface | 109 // EventTarget interface |
110 ExecutionContext* getExecutionContext() const override; | 110 ExecutionContext* getExecutionContext() const override; |
111 const AtomicString& interfaceName() const override; | 111 const AtomicString& interfaceName() const override; |
112 | 112 |
113 // WebSourceBufferClient interface | 113 // WebSourceBufferClient interface |
114 WebVector<WebMediaPlayer::TrackId> initializationSegmentReceived(const WebVe
ctor<MediaTrackInfo>&) override; | 114 bool initializationSegmentReceived(const WebVector<MediaTrackInfo>&) overrid
e; |
115 | 115 |
116 DECLARE_VIRTUAL_TRACE(); | 116 DECLARE_VIRTUAL_TRACE(); |
117 | 117 |
118 private: | 118 private: |
119 SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQue
ue*); | 119 SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQue
ue*); |
120 void dispose(); | 120 void dispose(); |
121 | 121 |
122 bool isRemoved() const; | 122 bool isRemoved() const; |
123 void scheduleEvent(const AtomicString& eventName); | 123 void scheduleEvent(const AtomicString& eventName); |
124 | 124 |
125 bool prepareAppend(size_t newDataSize, ExceptionState&); | 125 bool prepareAppend(size_t newDataSize, ExceptionState&); |
126 bool evictCodedFrames(size_t newDataSize); | 126 bool evictCodedFrames(size_t newDataSize); |
127 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); | 127 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); |
128 void appendBufferAsyncPart(); | 128 void appendBufferAsyncPart(); |
129 void appendError(bool decodeError); | 129 void appendError(bool decodeError); |
130 | 130 |
131 void removeAsyncPart(); | 131 void removeAsyncPart(); |
132 | 132 |
133 void appendStreamInternal(Stream*, ExceptionState&); | 133 void appendStreamInternal(Stream*, ExceptionState&); |
134 void appendStreamAsyncPart(); | 134 void appendStreamAsyncPart(); |
135 void appendStreamDone(bool success); | 135 void appendStreamDone(bool success); |
136 void clearAppendStreamState(); | 136 void clearAppendStreamState(); |
137 | 137 |
138 void removeMediaTracks(); | 138 void removeMediaTracks(); |
139 | 139 |
| 140 const TrackDefault* getTrackDefault(const AtomicString& trackType, const Ato
micString& byteStreamTrackID) const; |
| 141 AtomicString defaultTrackLabel(const AtomicString& trackType, const AtomicSt
ring& byteStreamTrackID) const; |
| 142 AtomicString defaultTrackLanguage(const AtomicString& trackType, const Atomi
cString& byteStreamTrackID) const; |
| 143 |
140 // FileReaderLoaderClient interface | 144 // FileReaderLoaderClient interface |
141 void didStartLoading() override; | 145 void didStartLoading() override; |
142 void didReceiveDataForClient(const char* data, unsigned dataLength) override
; | 146 void didReceiveDataForClient(const char* data, unsigned dataLength) override
; |
143 void didFinishLoading() override; | 147 void didFinishLoading() override; |
144 void didFail(FileError::ErrorCode) override; | 148 void didFail(FileError::ErrorCode) override; |
145 | 149 |
146 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; | 150 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; |
147 Member<MediaSource> m_source; | 151 Member<MediaSource> m_source; |
148 Member<TrackDefaultList> m_trackDefaults; | 152 Member<TrackDefaultList> m_trackDefaults; |
149 Member<GenericEventQueue> m_asyncEventQueue; | 153 Member<GenericEventQueue> m_asyncEventQueue; |
150 | 154 |
151 AtomicString m_mode; | 155 AtomicString m_mode; |
152 bool m_updating; | 156 bool m_updating; |
153 double m_timestampOffset; | 157 double m_timestampOffset; |
154 Member<AudioTrackList> m_audioTracks; | 158 Member<AudioTrackList> m_audioTracks; |
155 Member<VideoTrackList> m_videoTracks; | 159 Member<VideoTrackList> m_videoTracks; |
| 160 bool m_activeTrack = false; |
156 double m_appendWindowStart; | 161 double m_appendWindowStart; |
157 double m_appendWindowEnd; | 162 double m_appendWindowEnd; |
158 bool m_firstInitializationSegmentReceived; | 163 bool m_firstInitializationSegmentReceived; |
159 | 164 |
160 Vector<unsigned char> m_pendingAppendData; | 165 Vector<unsigned char> m_pendingAppendData; |
161 size_t m_pendingAppendDataOffset; | 166 size_t m_pendingAppendDataOffset; |
162 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; | 167 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; |
163 | 168 |
164 double m_pendingRemoveStart; | 169 double m_pendingRemoveStart; |
165 double m_pendingRemoveEnd; | 170 double m_pendingRemoveEnd; |
166 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; | 171 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; |
167 | 172 |
168 bool m_streamMaxSizeValid; | 173 bool m_streamMaxSizeValid; |
169 unsigned long long m_streamMaxSize; | 174 unsigned long long m_streamMaxSize; |
170 Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; | 175 Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; |
171 Member<Stream> m_stream; | 176 Member<Stream> m_stream; |
172 std::unique_ptr<FileReaderLoader> m_loader; | 177 std::unique_ptr<FileReaderLoader> m_loader; |
173 }; | 178 }; |
174 | 179 |
175 } // namespace blink | 180 } // namespace blink |
176 | 181 |
177 #endif // SourceBuffer_h | 182 #endif // SourceBuffer_h |
OLD | NEW |