| Index: third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
|
| diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
|
| index 9521cbb0a765b257ccab3117a12986c63d728e37..99dd8a4216d0dc46a8bd81bc17c869ad0195e874 100644
|
| --- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
|
| +++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
|
| @@ -38,7 +38,6 @@
|
| #include "core/dom/ExecutionContext.h"
|
| #include "core/events/Event.h"
|
| #include "core/events/GenericEventQueue.h"
|
| -#include "core/fileapi/FileReaderLoader.h"
|
| #include "core/frame/Deprecation.h"
|
| #include "core/frame/UseCounter.h"
|
| #include "core/html/HTMLMediaElement.h"
|
| @@ -48,7 +47,6 @@
|
| #include "core/html/track/AudioTrackList.h"
|
| #include "core/html/track/VideoTrack.h"
|
| #include "core/html/track/VideoTrackList.h"
|
| -#include "core/streams/Stream.h"
|
| #include "modules/mediasource/MediaSource.h"
|
| #include "modules/mediasource/SourceBufferTrackBaseSupplement.h"
|
| #include "platform/RuntimeEnabledFeatures.h"
|
| @@ -81,8 +79,8 @@ static bool throwExceptionIfRemovedOrUpdating(bool isRemoved,
|
| if (isUpdating) {
|
| MediaSource::logAndThrowDOMException(
|
| exceptionState, InvalidStateError,
|
| - "This SourceBuffer is still processing an 'appendBuffer', "
|
| - "'appendStream', or 'remove' operation.");
|
| + "This SourceBuffer is still processing an 'appendBuffer' or "
|
| + "'remove' operation.");
|
| return true;
|
| }
|
|
|
| @@ -138,12 +136,7 @@ SourceBuffer::SourceBuffer(std::unique_ptr<WebSourceBuffer> webSourceBuffer,
|
| m_pendingRemoveEnd(-1),
|
| m_removeAsyncPartRunner(AsyncMethodRunner<SourceBuffer>::create(
|
| this,
|
| - &SourceBuffer::removeAsyncPart)),
|
| - m_streamMaxSizeValid(false),
|
| - m_streamMaxSize(0),
|
| - m_appendStreamAsyncPartRunner(AsyncMethodRunner<SourceBuffer>::create(
|
| - this,
|
| - &SourceBuffer::appendStreamAsyncPart)) {
|
| + &SourceBuffer::removeAsyncPart)) {
|
| BLINK_SBLOG << __func__ << " this=" << this;
|
|
|
| DCHECK(m_webSourceBuffer);
|
| @@ -378,22 +371,6 @@ void SourceBuffer::appendBuffer(DOMArrayBufferView* data,
|
| data->byteLength(), exceptionState);
|
| }
|
|
|
| -void SourceBuffer::appendStream(Stream* stream,
|
| - ExceptionState& exceptionState) {
|
| - m_streamMaxSizeValid = false;
|
| - appendStreamInternal(stream, exceptionState);
|
| -}
|
| -
|
| -void SourceBuffer::appendStream(Stream* stream,
|
| - unsigned long long maxSize,
|
| - ExceptionState& exceptionState) {
|
| - BLINK_SBLOG << __func__ << " this=" << this << " maxSize=" << maxSize;
|
| - m_streamMaxSizeValid = maxSize > 0;
|
| - if (m_streamMaxSizeValid)
|
| - m_streamMaxSize = maxSize;
|
| - appendStreamInternal(stream, exceptionState);
|
| -}
|
| -
|
| void SourceBuffer::abort(ExceptionState& exceptionState) {
|
| BLINK_SBLOG << __func__ << " this=" << this;
|
| // http://w3c.github.io/media-source/#widl-SourceBuffer-abort-void
|
| @@ -559,12 +536,7 @@ void SourceBuffer::abortIfUpdating() {
|
|
|
| DCHECK_EQ(m_pendingRemoveStart, -1);
|
|
|
| - const char* traceEventName = 0;
|
| - if (m_stream) {
|
| - traceEventName = "SourceBuffer::appendStream";
|
| - } else {
|
| - traceEventName = "SourceBuffer::appendBuffer";
|
| - }
|
| + const char* traceEventName = "SourceBuffer::appendBuffer";
|
|
|
| // 4.1. Abort the buffer append and stream append loop algorithms if they are
|
| // running.
|
| @@ -572,9 +544,6 @@ void SourceBuffer::abortIfUpdating() {
|
| m_pendingAppendData.clear();
|
| m_pendingAppendDataOffset = 0;
|
|
|
| - m_appendStreamAsyncPartRunner->stop();
|
| - clearAppendStreamState();
|
| -
|
| // 4.2. Set the updating attribute to false.
|
| m_updating = false;
|
|
|
| @@ -1065,19 +1034,16 @@ bool SourceBuffer::hasPendingActivity() const {
|
| void SourceBuffer::suspend() {
|
| m_appendBufferAsyncPartRunner->suspend();
|
| m_removeAsyncPartRunner->suspend();
|
| - m_appendStreamAsyncPartRunner->suspend();
|
| }
|
|
|
| void SourceBuffer::resume() {
|
| m_appendBufferAsyncPartRunner->resume();
|
| m_removeAsyncPartRunner->resume();
|
| - m_appendStreamAsyncPartRunner->resume();
|
| }
|
|
|
| void SourceBuffer::contextDestroyed() {
|
| m_appendBufferAsyncPartRunner->stop();
|
| m_removeAsyncPartRunner->stop();
|
| - m_appendStreamAsyncPartRunner->stop();
|
| }
|
|
|
| ExecutionContext* SourceBuffer::getExecutionContext() const {
|
| @@ -1305,114 +1271,6 @@ void SourceBuffer::removeAsyncPart() {
|
| scheduleEvent(EventTypeNames::updateend);
|
| }
|
|
|
| -void SourceBuffer::appendStreamInternal(Stream* stream,
|
| - ExceptionState& exceptionState) {
|
| - TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this);
|
| -
|
| - // Section 3.2 appendStream()
|
| - // http://w3c.github.io/media-source/#widl-SourceBuffer-appendStream-void-ReadableStream-stream-unsigned-long-long-maxSize
|
| - // (0. If the stream has been neutered, then throw an InvalidAccessError
|
| - // exception and abort these steps.)
|
| - if (stream->isNeutered()) {
|
| - MediaSource::logAndThrowDOMException(
|
| - exceptionState, InvalidAccessError,
|
| - "The stream provided has been neutered.");
|
| - TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this);
|
| - return;
|
| - }
|
| -
|
| - // 1. Run the prepare append algorithm.
|
| - size_t newDataSize = m_streamMaxSizeValid ? m_streamMaxSize : 0;
|
| - if (!prepareAppend(newDataSize, exceptionState)) {
|
| - TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this);
|
| - return;
|
| - }
|
| -
|
| - // 2. Set the updating attribute to true.
|
| - m_updating = true;
|
| -
|
| - // 3. Queue a task to fire a simple event named updatestart at this
|
| - // SourceBuffer object.
|
| - scheduleEvent(EventTypeNames::updatestart);
|
| -
|
| - // 4. Asynchronously run the stream append loop algorithm with stream and
|
| - // maxSize.
|
| - stream->neuter();
|
| - m_loader = FileReaderLoader::create(FileReaderLoader::ReadByClient, this);
|
| - m_stream = stream;
|
| - m_appendStreamAsyncPartRunner->runAsync();
|
| -}
|
| -
|
| -void SourceBuffer::appendStreamAsyncPart() {
|
| - DCHECK(m_updating);
|
| - DCHECK(m_loader);
|
| - DCHECK(m_stream);
|
| - TRACE_EVENT_ASYNC_STEP_INTO0("media", "SourceBuffer::appendStream", this,
|
| - "appendStreamAsyncPart");
|
| -
|
| - // Section 3.5.6 Stream Append Loop
|
| - // http://w3c.github.io/media-source/#sourcebuffer-stream-append-loop
|
| -
|
| - // 1. If maxSize is set, then let bytesLeft equal maxSize.
|
| - // 2. Loop Top: If maxSize is set and bytesLeft equals 0, then jump to the
|
| - // loop done step below.
|
| - if (m_streamMaxSizeValid && !m_streamMaxSize) {
|
| - appendStreamDone(NoError);
|
| - return;
|
| - }
|
| -
|
| - // Steps 3-11 are handled by m_loader.
|
| - // Note: Passing 0 here signals that maxSize was not set. (i.e. Read all the
|
| - // data in the stream).
|
| - m_loader->start(getExecutionContext(), *m_stream,
|
| - m_streamMaxSizeValid ? m_streamMaxSize : 0);
|
| -}
|
| -
|
| -void SourceBuffer::appendStreamDone(AppendStreamDoneAction action) {
|
| - DCHECK(m_updating);
|
| - DCHECK(m_loader);
|
| - DCHECK(m_stream);
|
| -
|
| - clearAppendStreamState();
|
| -
|
| - if (action != NoError) {
|
| - if (action == RunAppendErrorWithNoDecodeError) {
|
| - appendError(NoDecodeError);
|
| - } else {
|
| - DCHECK_EQ(action, RunAppendErrorWithDecodeError);
|
| - appendError(DecodeError);
|
| - }
|
| -
|
| - TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this);
|
| - return;
|
| - }
|
| -
|
| - // Section 3.5.6 Stream Append Loop
|
| - // Steps 1-11 are handled by appendStreamAsyncPart(), |m_loader|, and
|
| - // |m_webSourceBuffer|.
|
| -
|
| - // 12. Loop Done: Set the updating attribute to false.
|
| - m_updating = false;
|
| -
|
| - // 13. Queue a task to fire a simple event named update at this SourceBuffer
|
| - // object.
|
| - scheduleEvent(EventTypeNames::update);
|
| -
|
| - // 14. Queue a task to fire a simple event named updateend at this
|
| - // SourceBuffer object.
|
| - scheduleEvent(EventTypeNames::updateend);
|
| - TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::appendStream", this);
|
| - BLINK_SBLOG << __func__ << " ended. this=" << this << " buffered="
|
| - << webTimeRangesToString(m_webSourceBuffer->buffered());
|
| -}
|
| -
|
| -void SourceBuffer::clearAppendStreamState() {
|
| - m_streamMaxSizeValid = false;
|
| - m_streamMaxSize = 0;
|
| - m_loader.reset();
|
| - m_stream = nullptr;
|
| -}
|
| -
|
| void SourceBuffer::appendError(AppendError err) {
|
| BLINK_SBLOG << __func__ << " this=" << this << " AppendError=" << err;
|
| // Section 3.5.3 Append Error Algorithm
|
| @@ -1442,57 +1300,12 @@ void SourceBuffer::appendError(AppendError err) {
|
| }
|
| }
|
|
|
| -void SourceBuffer::didStartLoading() {
|
| - BLINK_SBLOG << __func__ << " this=" << this;
|
| -}
|
| -
|
| -void SourceBuffer::didReceiveDataForClient(const char* data,
|
| - unsigned dataLength) {
|
| - BLINK_SBLOG << __func__ << " this=" << this << " dataLength=" << dataLength;
|
| - DCHECK(m_updating);
|
| - DCHECK(m_loader);
|
| -
|
| - // Section 3.5.6 Stream Append Loop
|
| - // http://w3c.github.io/media-source/#sourcebuffer-stream-append-loop
|
| -
|
| - // 10. Run the coded frame eviction algorithm.
|
| - if (!evictCodedFrames(dataLength)) {
|
| - // 11. (in appendStreamDone) If the buffer full flag equals true, then run
|
| - // the append error algorithm with the decode error parameter set to
|
| - // false and abort this algorithm.
|
| - appendStreamDone(RunAppendErrorWithNoDecodeError);
|
| - return;
|
| - }
|
| -
|
| - if (!m_webSourceBuffer->append(reinterpret_cast<const unsigned char*>(data),
|
| - dataLength, &m_timestampOffset))
|
| - appendStreamDone(RunAppendErrorWithDecodeError);
|
| -}
|
| -
|
| -void SourceBuffer::didFinishLoading() {
|
| - BLINK_SBLOG << __func__ << " this=" << this;
|
| - DCHECK(m_loader);
|
| - appendStreamDone(NoError);
|
| -}
|
| -
|
| -void SourceBuffer::didFail(FileError::ErrorCode errorCode) {
|
| - BLINK_SBLOG << __func__ << " this=" << this << " errorCode=" << errorCode;
|
| - // m_loader might be already released, in case appendStream has failed due
|
| - // to evictCodedFrames or WebSourceBuffer append failing in
|
| - // didReceiveDataForClient. In that case appendStreamDone will be invoked
|
| - // from there, no need to repeat it here.
|
| - if (m_loader)
|
| - appendStreamDone(RunAppendErrorWithNoDecodeError);
|
| -}
|
| -
|
| DEFINE_TRACE(SourceBuffer) {
|
| visitor->trace(m_source);
|
| visitor->trace(m_trackDefaults);
|
| visitor->trace(m_asyncEventQueue);
|
| visitor->trace(m_appendBufferAsyncPartRunner);
|
| visitor->trace(m_removeAsyncPartRunner);
|
| - visitor->trace(m_appendStreamAsyncPartRunner);
|
| - visitor->trace(m_stream);
|
| visitor->trace(m_audioTracks);
|
| visitor->trace(m_videoTracks);
|
| EventTargetWithInlineData::trace(visitor);
|
|
|