Diff
Modified: trunk/LayoutTests/ChangeLog (125681 => 125682)
--- trunk/LayoutTests/ChangeLog 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/LayoutTests/ChangeLog 2012-08-15 16:58:02 UTC (rev 125682)
@@ -1,3 +1,17 @@
+2012-08-15 Anna Cavender <ann...@chromium.org>
+
+ Add the timestampOffset attribute to SourceBuffer.
+ https://bugs.webkit.org/show_bug.cgi?id=93303
+
+ Reviewed by Dimitri Glazkov.
+
+ On the 30 July 2012 version of the Media Source Extensions spec, a timestampOffset
+ attribute was added to the SourceBuffer object:
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-timestampoffset
+
+ * http/tests/media/media-source/video-media-source-objects-expected.txt:
+ * http/tests/media/media-source/video-media-source-objects.html:
+
2012-08-15 Pavel Chadnov <chad...@google.com>
Web Inspector: Incorrect XHR responses when two async xhrs are sent synchronously
Modified: trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects-expected.txt (125681 => 125682)
--- trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects-expected.txt 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects-expected.txt 2012-08-15 16:58:02 UTC (rev 125682)
@@ -26,6 +26,16 @@
EXPECTED (mediaSource.sourceBuffers[0].buffered.start(0) == '0') OK
EXPECTED (mediaSource.sourceBuffers[0].buffered.end(0) > '1') OK
+Set timestampOffset.
+EXPECTED (segmentHelper.sourceBuffer.timestampOffset == '0') OK
+RUN(segmentHelper.sourceBuffer.timestampOffset = 5)
+EXPECTED (segmentHelper.sourceBuffer.timestampOffset == '5') OK
+
+Append 1 second of data.
+EXPECTED (mediaSource.sourceBuffers[0].buffered.length == '2') OK
+EXPECTED (mediaSource.sourceBuffers[0].buffered.start(1) == '5') OK
+EXPECTED (mediaSource.sourceBuffers[0].buffered.end(1) > '1') OK
+
Remove SourceBuffer
RUN(mediaSource.removeSourceBuffer(segmentHelper.sourceBuffer))
EXPECTED (mediaSource.sourceBuffers.length == '0') OK
@@ -38,5 +48,7 @@
EXPECTED (mediaSource.sourceBuffers.length == '0') OK
Test that addSourceBuffer() throws and error when the MediaSource is not associated with a media element.
Got expected exception Error: INVALID_STATE_ERR: DOM Exception 11
+Test that setting timestampOffset throws an error when the MediaSource is not associated with a media element.
+Got expected exception Error: INVALID_STATE_ERR: DOM Exception 11
END OF TEST
Modified: trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects.html (125681 => 125682)
--- trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects.html 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects.html 2012-08-15 16:58:02 UTC (rev 125682)
@@ -43,6 +43,22 @@
testExpected("mediaSource.sourceBuffers[0].buffered.end(0)", 1, '>');
consoleWrite("");
+ consoleWrite("Set timestampOffset.");
+ testExpected("segmentHelper.sourceBuffer.timestampOffset", 0);
+ run("segmentHelper.sourceBuffer.timestampOffset = 5");
+ testExpected("segmentHelper.sourceBuffer.timestampOffset", 5);
+
+ // Append another 1 second of media data.
+ consoleWrite("");
+ consoleWrite("Append 1 second of data.");
+ var endIndex = segmentHelper.getMediaSegmentIndexForTimestamp(1);
+ for (var i = 0; i <= endIndex; i++)
+ segmentHelper.appendMediaSegment(i);
+ testExpected("mediaSource.sourceBuffers[0].buffered.length", 2);
+ testExpected("mediaSource.sourceBuffers[0].buffered.start(1)", 5);
+ testExpected("mediaSource.sourceBuffers[0].buffered.end(1)", 1, '>');
+
+ consoleWrite("");
consoleWrite("Remove SourceBuffer");
mediaSource.sourceBuffers.addEventListener('webkitremovesourcebuffer', onSourceBufferRemoved);
@@ -58,6 +74,13 @@
consoleWrite("Got expected exception " + e);
}
+ consoleWrite("Test that setting timestampOffset throws an error when the MediaSource is not associated with a media element.");
+ try {
+ segmentHelper.sourceBuffer.timestampOffset = 10;
+ } catch (e) {
+ consoleWrite("Got expected exception " + e);
+ }
+
endTest();
}
Modified: trunk/Source/WebCore/ChangeLog (125681 => 125682)
--- trunk/Source/WebCore/ChangeLog 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/ChangeLog 2012-08-15 16:58:02 UTC (rev 125682)
@@ -1,3 +1,38 @@
+2012-08-15 Anna Cavender <ann...@chromium.org>
+
+ Add the timestampOffset attribute to SourceBuffer.
+ https://bugs.webkit.org/show_bug.cgi?id=93303
+
+ Reviewed by Dimitri Glazkov.
+
+ On the 30 July 2012 version of the Media Source Extensions spec, a timestampOffset
+ attribute was added to the SourceBuffer object:
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-timestampoffset
+
+ Tests: additions to http/tests/media/media-source/video-media-source-objects.html
+
+ * Modules/mediasource/MediaSource.cpp:
+ (WebCore::MediaSource::setTimestampOffset): Set the timestampOffset on MediaPlayer.
+ (WebCore):
+ * Modules/mediasource/MediaSource.h:
+ (MediaSource):
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::SourceBuffer): Let the timestampOffset be 0 initially
+ (WebCore::SourceBuffer::timestampOffset): Return the last value set.
+ (WebCore):
+ (WebCore::SourceBuffer::setTimestampOffset): Forward the call onto MediaSouce.
+ * Modules/mediasource/SourceBuffer.h:
+ (SourceBuffer):
+ * Modules/mediasource/SourceBuffer.idl: Create the new timestampOffset attr.
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::NullMediaPlayerPrivate::sourceSetTimestampOffset): A null media player
+ should just return false (nothing to set).
+ (WebCore):
+ (WebCore::MediaPlayer::sourceSetTimestampOffset): Forward the call.
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/MediaPlayerPrivate.h:
+ (WebCore::MediaPlayerPrivateInterface::sourceSetTimestampOffset):
+
2012-08-15 Pavel Chadnov <chad...@google.com>
Web Inspector: Incorrect XHR responses when two async xhrs are sent synchronously
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (125681 => 125682)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2012-08-15 16:58:02 UTC (rev 125682)
@@ -267,6 +267,20 @@
ASSERT_NOT_REACHED();
}
+bool MediaSource::setTimestampOffset(const String& id, double offset, ExceptionCode& ec)
+{
+ if (!m_player || m_readyState != openKeyword()) {
+ ec = INVALID_STATE_ERR;
+ return false;
+ }
+
+ if (!m_player->sourceSetTimestampOffset(id, offset)) {
+ ec = INVALID_STATE_ERR;
+ return false;
+ }
+ return true;
+}
+
const AtomicString& MediaSource::interfaceName() const
{
return eventNames().interfaceForMediaSource;
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.h (125681 => 125682)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -80,6 +80,7 @@
PassRefPtr<TimeRanges> buffered(const String& id, ExceptionCode&) const;
void append(const String& id, PassRefPtr<Uint8Array> data, ExceptionCode&);
void abort(const String& id, ExceptionCode&);
+ bool setTimestampOffset(const String& id, double, ExceptionCode&);
// EventTarget interface
virtual const AtomicString& interfaceName() const OVERRIDE;
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (125681 => 125682)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2012-08-15 16:58:02 UTC (rev 125682)
@@ -41,6 +41,7 @@
SourceBuffer::SourceBuffer(const String& id, PassRefPtr<MediaSource> source)
: m_id(id)
, m_source(source)
+ , m_timestampOffset(0)
{
}
@@ -58,6 +59,22 @@
return m_source->buffered(id(), ec);
}
+double SourceBuffer::timestampOffset() const
+{
+ return m_timestampOffset;
+}
+
+void SourceBuffer::setTimestampOffset(double offset, ExceptionCode& ec)
+{
+ if (!m_source) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
+ if (m_source->setTimestampOffset(id(), offset, ec))
+ m_timestampOffset = offset;
+}
+
void SourceBuffer::append(PassRefPtr<Uint8Array> data, ExceptionCode& ec)
{
if (!m_source) {
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (125681 => 125682)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -54,6 +54,9 @@
PassRefPtr<TimeRanges> buffered(ExceptionCode&) const;
+ double timestampOffset() const;
+ void setTimestampOffset(double, ExceptionCode&);
+
void append(PassRefPtr<Uint8Array> data, ExceptionCode&);
void abort(ExceptionCode&);
@@ -67,6 +70,8 @@
String m_id;
RefPtr<MediaSource> m_source;
+
+ double m_timestampOffset;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl (125681 => 125682)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl 2012-08-15 16:58:02 UTC (rev 125682)
@@ -39,6 +39,10 @@
readonly attribute TimeRanges buffered
getter raises(DOMException);
+ // Applies an offset to media segment timestamps.
+ attribute double timestampOffset
+ setter raises(DOMException);
+
// Append segment data.
void append(in Uint8Array data) raises (DOMException);
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (125681 => 125682)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2012-08-15 16:58:02 UTC (rev 125682)
@@ -155,6 +155,7 @@
virtual bool sourceAppend(const String&, const unsigned char*, unsigned) { return false; }
virtual bool sourceAbort(const String&) { return false; }
virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { }
+ virtual bool sourceSetTimestampOffset(const String&, double) { return false; }
#endif
#if ENABLE(ENCRYPTED_MEDIA)
@@ -492,6 +493,11 @@
{
return m_private->sourceEndOfStream(status);
}
+
+bool MediaPlayer::sourceSetTimestampOffset(const String& id, double offset)
+{
+ return m_private->sourceSetTimestampOffset(id, offset);
+}
#endif
#if ENABLE(ENCRYPTED_MEDIA)
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (125681 => 125682)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -256,6 +256,7 @@
bool sourceAbort(const String& id);
enum EndOfStreamStatus { EosNoError, EosNetworkError, EosDecodeError };
void sourceEndOfStream(EndOfStreamStatus);
+ bool sourceSetTimestampOffset(const String& id, double offset);
#endif
#if ENABLE(ENCRYPTED_MEDIA)
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (125681 => 125682)
--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -174,6 +174,7 @@
virtual bool sourceAppend(const String& id, const unsigned char* data, unsigned length) { return false; }
virtual bool sourceAbort(const String& id) { return false; }
virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { };
+ virtual bool sourceSetTimestampOffset(const String& id, double offset) { return false; }
#endif
#if ENABLE(ENCRYPTED_MEDIA)
Modified: trunk/Source/WebKit/chromium/ChangeLog (125681 => 125682)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-15 16:58:02 UTC (rev 125682)
@@ -1,3 +1,22 @@
+2012-08-15 Anna Cavender <ann...@chromium.org>
+
+ Add the timestampOffset attribute to SourceBuffer.
+ https://bugs.webkit.org/show_bug.cgi?id=93303
+
+ Reviewed by Dimitri Glazkov.
+
+ On the 30 July 2012 version of the Media Source Extensions spec, a timestampOffset
+ attribute was added to the SourceBuffer object:
+ http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-timestampoffset
+
+ * public/WebMediaPlayer.h:
+ (WebKit::WebMediaPlayer::sourceSetTimestampOffset): Add the new method.
+ * src/WebMediaPlayerClientImpl.cpp:
+ (WebKit):
+ (WebKit::WebMediaPlayerClientImpl::sourceSetTimestampOffset): Forward the call.
+ * src/WebMediaPlayerClientImpl.h:
+ (WebMediaPlayerClientImpl):
+
2012-08-15 Peter Beverloo <pe...@chromium.org>
[Chromium] Roll WebKit Chromium DEPS to r151672
Modified: trunk/Source/WebKit/chromium/public/WebMediaPlayer.h (125681 => 125682)
--- trunk/Source/WebKit/chromium/public/WebMediaPlayer.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebKit/chromium/public/WebMediaPlayer.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -187,6 +187,7 @@
virtual bool sourceAppend(const WebString& id, const unsigned char* data, unsigned length) { return false; }
virtual bool sourceAbort(const WebString& id) { return false; }
virtual void sourceEndOfStream(EndOfStreamStatus) { }
+ virtual bool sourceSetTimestampOffset(const WebString& id, double offset) { return false; }
// Returns whether keySystem is supported. If true, the result will be
// reported by an event.
Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (125681 => 125682)
--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2012-08-15 16:58:02 UTC (rev 125682)
@@ -435,6 +435,13 @@
if (m_webMediaPlayer)
m_webMediaPlayer->sourceEndOfStream(static_cast<WebMediaPlayer::EndOfStreamStatus>(status));
}
+
+bool WebMediaPlayerClientImpl::sourceSetTimestampOffset(const String& id, double offset)
+{
+ if (!m_webMediaPlayer)
+ return false;
+ return m_webMediaPlayer->sourceSetTimestampOffset(id, offset);
+}
#endif
#if ENABLE(ENCRYPTED_MEDIA)
Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (125681 => 125682)
--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-08-15 16:50:13 UTC (rev 125681)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2012-08-15 16:58:02 UTC (rev 125682)
@@ -164,6 +164,7 @@
virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length);
virtual bool sourceAbort(const String&);
virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus);
+ virtual bool sourceSetTimestampOffset(const String&, double offset);
#endif
#if ENABLE(ENCRYPTED_MEDIA)