Index: Source/modules/mediasource/MediaSourceBase.cpp |
diff --git a/Source/modules/mediasource/MediaSourceBase.cpp b/Source/modules/mediasource/MediaSourceBase.cpp |
index b31b9ca324715463b58666d54bb8e8d38074c873..c581e7270bf15cbb62c14445428d22ff8a6a9d8a 100644 |
--- a/Source/modules/mediasource/MediaSourceBase.cpp |
+++ b/Source/modules/mediasource/MediaSourceBase.cpp |
@@ -36,12 +36,17 @@ |
#include "core/dom/ExceptionCode.h" |
#include "core/events/Event.h" |
#include "core/events/GenericEventQueue.h" |
-#include "core/platform/graphics/SourceBufferPrivate.h" |
+#include "core/html/TimeRanges.h" |
#include "modules/mediasource/MediaSourceRegistry.h" |
#include "platform/Logging.h" |
#include "platform/TraceEvent.h" |
+#include "public/platform/WebMediaSource.h" |
+#include "public/platform/WebSourceBuffer.h" |
#include "wtf/text/WTFString.h" |
+using blink::WebMediaSource; |
+using blink::WebSourceBuffer; |
+ |
namespace WebCore { |
MediaSourceBase::MediaSourceBase(ExecutionContext* context) |
@@ -74,13 +79,13 @@ const AtomicString& MediaSourceBase::endedKeyword() |
return ended; |
} |
-void MediaSourceBase::setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate> mediaSourcePrivate) |
+void MediaSourceBase::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSource) |
{ |
TRACE_EVENT_ASYNC_END0("media", "MediaSourceBase::attachToElement", this); |
- ASSERT(mediaSourcePrivate); |
- ASSERT(!m_private); |
+ ASSERT(webMediaSource); |
+ ASSERT(!m_webMediaSource); |
ASSERT(m_attachedElement); |
- m_private = mediaSourcePrivate; |
+ m_webMediaSource = webMediaSource; |
setReadyState(openKeyword()); |
} |
@@ -96,7 +101,7 @@ void MediaSourceBase::removedFromRegistry() |
double MediaSourceBase::duration() const |
{ |
- return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_private->duration(); |
+ return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_webMediaSource->duration(); |
} |
PassRefPtr<TimeRanges> MediaSourceBase::buffered() const |
@@ -157,7 +162,7 @@ void MediaSourceBase::setDuration(double duration, ExceptionState& es) |
// Synchronously process duration change algorithm to enforce any required |
// seek is started prior to returning. |
m_attachedElement->durationChanged(duration); |
- m_private->setDuration(duration); |
+ m_webMediaSource->setDuration(duration); |
} |
@@ -169,7 +174,7 @@ void MediaSourceBase::setReadyState(const AtomicString& state) |
LOG(Media, "MediaSourceBase::setReadyState() %p : %s -> %s", this, oldState.string().ascii().data(), state.string().ascii().data()); |
if (state == closedKeyword()) { |
- m_private.clear(); |
+ m_webMediaSource.clear(); |
m_attachedElement = 0; |
} |
@@ -194,14 +199,14 @@ void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionState& es) |
return; |
} |
- MediaSourcePrivate::EndOfStreamStatus eosStatus = MediaSourcePrivate::EosNoError; |
+ WebMediaSource::EndOfStreamStatus eosStatus = WebMediaSource::EndOfStreamStatusNoError; |
if (error.isNull() || error.isEmpty()) { |
- eosStatus = MediaSourcePrivate::EosNoError; |
+ eosStatus = WebMediaSource::EndOfStreamStatusNoError; |
} else if (error == network) { |
- eosStatus = MediaSourcePrivate::EosNetworkError; |
+ eosStatus = WebMediaSource::EndOfStreamStatusNetworkError; |
} else if (error == decode) { |
- eosStatus = MediaSourcePrivate::EosDecodeError; |
+ eosStatus = WebMediaSource::EndOfStreamStatusDecodeError; |
} else { |
es.throwUninformativeAndGenericDOMException(InvalidAccessError); |
return; |
@@ -209,7 +214,7 @@ void MediaSourceBase::endOfStream(const AtomicString& error, ExceptionState& es) |
// 2. Change the readyState attribute value to "ended". |
setReadyState(endedKeyword()); |
- m_private->markEndOfStream(eosStatus); |
+ m_webMediaSource->markEndOfStream(eosStatus); |
} |
bool MediaSourceBase::isOpen() const |
@@ -245,12 +250,12 @@ void MediaSourceBase::openIfInEndedState() |
return; |
setReadyState(openKeyword()); |
- m_private->unmarkEndOfStream(); |
+ m_webMediaSource->unmarkEndOfStream(); |
} |
bool MediaSourceBase::hasPendingActivity() const |
{ |
- return m_private || m_asyncEventQueue->hasPendingEvents() |
+ return m_webMediaSource || m_asyncEventQueue->hasPendingEvents() |
|| ActiveDOMObject::hasPendingActivity(); |
} |
@@ -259,24 +264,25 @@ void MediaSourceBase::stop() |
m_asyncEventQueue->close(); |
if (!isClosed()) |
setReadyState(closedKeyword()); |
- m_private.clear(); |
+ m_webMediaSource.clear(); |
} |
-PassOwnPtr<SourceBufferPrivate> MediaSourceBase::createSourceBufferPrivate(const String& type, const MediaSourcePrivate::CodecsArray& codecs, ExceptionState& es) |
+PassOwnPtr<WebSourceBuffer> MediaSourceBase::createWebSourceBuffer(const String& type, const Vector<String>& codecs, ExceptionState& es) |
{ |
- OwnPtr<SourceBufferPrivate> sourceBufferPrivate; |
- switch (m_private->addSourceBuffer(type, codecs, &sourceBufferPrivate)) { |
- case MediaSourcePrivate::Ok: { |
- return sourceBufferPrivate.release(); |
- } |
- case MediaSourcePrivate::NotSupported: |
+ WebSourceBuffer* webSourceBuffer = 0; |
+ switch (m_webMediaSource->addSourceBuffer(type, codecs, &webSourceBuffer)) { |
+ case WebMediaSource::AddStatusOk: |
+ return adoptPtr(webSourceBuffer); |
+ case WebMediaSource::AddStatusNotSupported: |
+ ASSERT(!webSourceBuffer); |
// 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
// Step 2: If type contains a MIME type ... that is not supported with the types |
// specified for the other SourceBuffer objects in sourceBuffers, then throw |
// a NotSupportedError exception and abort these steps. |
es.throwUninformativeAndGenericDOMException(NotSupportedError); |
return nullptr; |
- case MediaSourcePrivate::ReachedIdLimit: |
+ case WebMediaSource::AddStatusReachedIdLimit: |
+ ASSERT(!webSourceBuffer); |
// 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type |
// Step 3: If the user agent can't handle any more SourceBuffer objects then throw |
// a QuotaExceededError exception and abort these steps. |