Chromium Code Reviews| Index: Source/modules/mediasource/SourceBuffer.cpp |
| diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp |
| index b96ae089ced46efedc12fce4dde6d8cac5e3b674..1f618ff00d0eeb6aa2aafdeb7d8433ea204a26e0 100644 |
| --- a/Source/modules/mediasource/SourceBuffer.cpp |
| +++ b/Source/modules/mediasource/SourceBuffer.cpp |
| @@ -89,6 +89,7 @@ SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou |
| , m_timestampOffset(0) |
| , m_appendWindowStart(0) |
| , m_appendWindowEnd(std::numeric_limits<double>::infinity()) |
| + , m_firstInitializationSegment(false) |
| , m_pendingAppendDataOffset(0) |
| , m_appendBufferAsyncPartRunner(this, &SourceBuffer::appendBufferAsyncPart) |
| , m_pendingRemoveStart(-1) |
| @@ -101,6 +102,7 @@ SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou |
| ASSERT(m_webSourceBuffer); |
| ASSERT(m_source); |
| ScriptWrappable::init(this); |
| + m_webSourceBuffer->setClient(this); |
| } |
| SourceBuffer::~SourceBuffer() |
| @@ -112,6 +114,10 @@ SourceBuffer::~SourceBuffer() |
| ASSERT(isRemoved()); |
| ASSERT(!m_loader); |
| ASSERT(!m_stream); |
| + ASSERT(!m_webSourceBuffer); |
| +#else |
| + if (m_webSourceBuffer) |
|
acolwell GONE FROM CHROMIUM
2014/09/09 22:23:21
nit: I don't think you'll need this. You should al
wolenetz
2014/09/10 00:42:29
Done.
|
| + m_webSourceBuffer->setClient(0); |
| #endif |
| } |
| @@ -415,11 +421,35 @@ void SourceBuffer::removedFromMediaSource() |
| abortIfUpdating(); |
| m_webSourceBuffer->removedFromMediaSource(); |
| + m_webSourceBuffer->setClient(0); |
|
acolwell GONE FROM CHROMIUM
2014/09/09 22:23:21
nit: Seems like this could be part of removedFromM
wolenetz
2014/09/10 00:42:29
Done.
|
| m_webSourceBuffer.clear(); |
| m_source = nullptr; |
| m_asyncEventQueue = 0; |
| } |
| +void SourceBuffer::initializationSegmentReceived() |
| +{ |
| + ASSERT(m_source); |
| + ASSERT(m_updating); |
| + |
| + // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer-init-segment-received |
| + // FIXME: Make steps 1-7 synchronous with this call. |
| + // FIXME: Augment the interface to this method to implement compliant steps 4-7 here. |
| + // Step 3 (if the first initialization segment flag is true) is implemented |
| + // by caller. |
| + |
| + if (!m_firstInitializationSegment) { |
| + // 5. If active track flag equals true, then run the following steps: |
| + // 5.1. Add this SourceBuffer to activeSourceBuffers. |
| + // 5.2. Queue a task to fire a simple event named addsourcebuffer at |
| + // activesourcebuffers. |
| + m_source->setSourceBufferActive(this); |
| + |
| + // 6. Set first initialization segment flag to true. |
| + m_firstInitializationSegment = true; |
| + } |
| +} |
| + |
| bool SourceBuffer::hasPendingActivity() const |
| { |
| return m_source; |