| 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 22 matching lines...) Expand all Loading... |
| 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" | 36 #include "core/fileapi/FileReaderLoaderClient.h" |
| 37 #include "modules/EventTargetModules.h" | 37 #include "modules/EventTargetModules.h" |
| 38 #include "modules/mediasource/TrackDefaultList.h" | 38 #include "modules/mediasource/TrackDefaultList.h" |
| 39 #include "platform/AsyncMethodRunner.h" | 39 #include "platform/AsyncMethodRunner.h" |
| 40 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 41 #include "public/platform/WebSourceBufferClient.h" | 41 #include "public/platform/WebSourceBufferClient.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 #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; | 50 class FileReaderLoader; |
| 52 class GenericEventQueue; | 51 class GenericEventQueue; |
| 53 class MediaSource; | 52 class MediaSource; |
| 54 class Stream; | 53 class Stream; |
| 55 class TimeRanges; | 54 class TimeRanges; |
| 56 class VideoTrackList; | 55 class VideoTrackList; |
| 57 class WebSourceBuffer; | 56 class WebSourceBuffer; |
| 58 | 57 |
| 59 class SourceBuffer final | 58 class SourceBuffer final |
| 60 : public EventTargetWithInlineData | 59 : public EventTargetWithInlineData |
| 61 , public ActiveScriptWrappable | 60 , public ActiveScriptWrappable |
| 62 , public ActiveDOMObject | 61 , public ActiveDOMObject |
| 63 , public FileReaderLoaderClient | 62 , public FileReaderLoaderClient |
| 64 , public WebSourceBufferClient { | 63 , public WebSourceBufferClient { |
| 65 USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); | 64 USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); |
| 66 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
| 67 USING_PRE_FINALIZER(SourceBuffer, dispose); | 66 USING_PRE_FINALIZER(SourceBuffer, dispose); |
| 68 public: | 67 public: |
| 69 static SourceBuffer* create(std::unique_ptr<WebSourceBuffer>, MediaSource*,
GenericEventQueue*); | 68 static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, Gener
icEventQueue*); |
| 70 static const AtomicString& segmentsKeyword(); | 69 static const AtomicString& segmentsKeyword(); |
| 71 static const AtomicString& sequenceKeyword(); | 70 static const AtomicString& sequenceKeyword(); |
| 72 | 71 |
| 73 ~SourceBuffer() override; | 72 ~SourceBuffer() override; |
| 74 | 73 |
| 75 // SourceBuffer.idl methods | 74 // SourceBuffer.idl methods |
| 76 const AtomicString& mode() const { return m_mode; } | 75 const AtomicString& mode() const { return m_mode; } |
| 77 void setMode(const AtomicString&, ExceptionState&); | 76 void setMode(const AtomicString&, ExceptionState&); |
| 78 bool updating() const { return m_updating; } | 77 bool updating() const { return m_updating; } |
| 79 TimeRanges* buffered(ExceptionState&) const; | 78 TimeRanges* buffered(ExceptionState&) const; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 // EventTarget interface | 108 // EventTarget interface |
| 110 ExecutionContext* getExecutionContext() const override; | 109 ExecutionContext* getExecutionContext() const override; |
| 111 const AtomicString& interfaceName() const override; | 110 const AtomicString& interfaceName() const override; |
| 112 | 111 |
| 113 // WebSourceBufferClient interface | 112 // WebSourceBufferClient interface |
| 114 WebVector<WebMediaPlayer::TrackId> initializationSegmentReceived(const WebVe
ctor<MediaTrackInfo>&) override; | 113 WebVector<WebMediaPlayer::TrackId> initializationSegmentReceived(const WebVe
ctor<MediaTrackInfo>&) override; |
| 115 | 114 |
| 116 DECLARE_VIRTUAL_TRACE(); | 115 DECLARE_VIRTUAL_TRACE(); |
| 117 | 116 |
| 118 private: | 117 private: |
| 119 SourceBuffer(std::unique_ptr<WebSourceBuffer>, MediaSource*, GenericEventQue
ue*); | 118 SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); |
| 120 void dispose(); | 119 void dispose(); |
| 121 | 120 |
| 122 bool isRemoved() const; | 121 bool isRemoved() const; |
| 123 void scheduleEvent(const AtomicString& eventName); | 122 void scheduleEvent(const AtomicString& eventName); |
| 124 | 123 |
| 125 bool prepareAppend(size_t newDataSize, ExceptionState&); | 124 bool prepareAppend(size_t newDataSize, ExceptionState&); |
| 126 bool evictCodedFrames(size_t newDataSize); | 125 bool evictCodedFrames(size_t newDataSize); |
| 127 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); | 126 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); |
| 128 void appendBufferAsyncPart(); | 127 void appendBufferAsyncPart(); |
| 129 void appendError(bool decodeError); | 128 void appendError(bool decodeError); |
| 130 | 129 |
| 131 void removeAsyncPart(); | 130 void removeAsyncPart(); |
| 132 | 131 |
| 133 void appendStreamInternal(Stream*, ExceptionState&); | 132 void appendStreamInternal(Stream*, ExceptionState&); |
| 134 void appendStreamAsyncPart(); | 133 void appendStreamAsyncPart(); |
| 135 void appendStreamDone(bool success); | 134 void appendStreamDone(bool success); |
| 136 void clearAppendStreamState(); | 135 void clearAppendStreamState(); |
| 137 | 136 |
| 138 void removeMediaTracks(); | 137 void removeMediaTracks(); |
| 139 | 138 |
| 140 // FileReaderLoaderClient interface | 139 // FileReaderLoaderClient interface |
| 141 void didStartLoading() override; | 140 void didStartLoading() override; |
| 142 void didReceiveDataForClient(const char* data, unsigned dataLength) override
; | 141 void didReceiveDataForClient(const char* data, unsigned dataLength) override
; |
| 143 void didFinishLoading() override; | 142 void didFinishLoading() override; |
| 144 void didFail(FileError::ErrorCode) override; | 143 void didFail(FileError::ErrorCode) override; |
| 145 | 144 |
| 146 std::unique_ptr<WebSourceBuffer> m_webSourceBuffer; | 145 OwnPtr<WebSourceBuffer> m_webSourceBuffer; |
| 147 Member<MediaSource> m_source; | 146 Member<MediaSource> m_source; |
| 148 Member<TrackDefaultList> m_trackDefaults; | 147 Member<TrackDefaultList> m_trackDefaults; |
| 149 Member<GenericEventQueue> m_asyncEventQueue; | 148 Member<GenericEventQueue> m_asyncEventQueue; |
| 150 | 149 |
| 151 AtomicString m_mode; | 150 AtomicString m_mode; |
| 152 bool m_updating; | 151 bool m_updating; |
| 153 double m_timestampOffset; | 152 double m_timestampOffset; |
| 154 Member<AudioTrackList> m_audioTracks; | 153 Member<AudioTrackList> m_audioTracks; |
| 155 Member<VideoTrackList> m_videoTracks; | 154 Member<VideoTrackList> m_videoTracks; |
| 156 double m_appendWindowStart; | 155 double m_appendWindowStart; |
| 157 double m_appendWindowEnd; | 156 double m_appendWindowEnd; |
| 158 bool m_firstInitializationSegmentReceived; | 157 bool m_firstInitializationSegmentReceived; |
| 159 | 158 |
| 160 Vector<unsigned char> m_pendingAppendData; | 159 Vector<unsigned char> m_pendingAppendData; |
| 161 size_t m_pendingAppendDataOffset; | 160 size_t m_pendingAppendDataOffset; |
| 162 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; | 161 Member<AsyncMethodRunner<SourceBuffer>> m_appendBufferAsyncPartRunner; |
| 163 | 162 |
| 164 double m_pendingRemoveStart; | 163 double m_pendingRemoveStart; |
| 165 double m_pendingRemoveEnd; | 164 double m_pendingRemoveEnd; |
| 166 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; | 165 Member<AsyncMethodRunner<SourceBuffer>> m_removeAsyncPartRunner; |
| 167 | 166 |
| 168 bool m_streamMaxSizeValid; | 167 bool m_streamMaxSizeValid; |
| 169 unsigned long long m_streamMaxSize; | 168 unsigned long long m_streamMaxSize; |
| 170 Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; | 169 Member<AsyncMethodRunner<SourceBuffer>> m_appendStreamAsyncPartRunner; |
| 171 Member<Stream> m_stream; | 170 Member<Stream> m_stream; |
| 172 std::unique_ptr<FileReaderLoader> m_loader; | 171 OwnPtr<FileReaderLoader> m_loader; |
| 173 }; | 172 }; |
| 174 | 173 |
| 175 } // namespace blink | 174 } // namespace blink |
| 176 | 175 |
| 177 #endif // SourceBuffer_h | 176 #endif // SourceBuffer_h |
| OLD | NEW |