Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1555)

Unified Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 178763006: Enable round-tripping and updating of SourceBuffer timestamp offset (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addresses PS1 comments Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/mediasource/SourceBuffer.cpp
diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp
index 3f9bbf97b7ac9d4c9188c45eccb459d9880f1c03..d3c03c0c6b597c2b09224ec28a1b1c4e657b1cd3 100644
--- a/Source/modules/mediasource/SourceBuffer.cpp
+++ b/Source/modules/mediasource/SourceBuffer.cpp
@@ -483,6 +483,13 @@ void SourceBuffer::scheduleEvent(const AtomicString& eventName)
m_asyncEventQueue->enqueueEvent(event.release());
}
+void SourceBuffer::updateTimestampOffsetIfNecessary()
+{
+ double offset = m_webSourceBuffer->updatedTimestampOffset();
+ if (!std::isnan(offset))
+ m_timestampOffset = offset;
+}
+
void SourceBuffer::appendBufferInternal(const unsigned char* data, unsigned size, ExceptionState& exceptionState)
{
// Section 3.2 appendBuffer()
@@ -536,6 +543,10 @@ void SourceBuffer::appendBufferAsyncPart()
}
m_webSourceBuffer->append(m_pendingAppendData.data(), appendSize);
+ // Update our cached |m_timestampOffset| since the implementation may change
+ // it during append() processing.
+ updateTimestampOffsetIfNecessary();
+
// 3. Set the updating attribute to false.
m_updating = false;
m_pendingAppendData.clear();
@@ -690,6 +701,10 @@ void SourceBuffer::didReceiveDataForClient(const char* data, unsigned dataLength
ASSERT(m_loader);
m_webSourceBuffer->append(reinterpret_cast<const unsigned char*>(data), dataLength);
+
+ // Update our cached |m_timestampOffset| since the implementation may change
+ // it during append() processing.
+ updateTimestampOffsetIfNecessary();
}
void SourceBuffer::didFinishLoading()

Powered by Google App Engine
This is Rietveld 408576698