Diff
Modified: trunk/LayoutTests/ChangeLog (160738 => 160739)
--- trunk/LayoutTests/ChangeLog 2013-12-18 00:56:39 UTC (rev 160738)
+++ trunk/LayoutTests/ChangeLog 2013-12-18 00:57:44 UTC (rev 160739)
@@ -1,3 +1,13 @@
+2013-12-17 Jer Noble <[email protected]>
+
+ [MSE] Update duration after appending samples, per spec.
+ https://bugs.webkit.org/show_bug.cgi?id=125703
+
+ Reviewed by Eric Carlson.
+
+ * media/media-source/media-source-duration-after-append-expected.txt: Added.
+ * media/media-source/media-source-duration-after-append.html: Added.
+
2013-12-17 Ryosuke Niwa <[email protected]>
Video element's width and height content attributes should not influence intrinsic width and height
Added: trunk/LayoutTests/media/media-source/media-source-duration-after-append-expected.txt (0 => 160739)
--- trunk/LayoutTests/media/media-source/media-source-duration-after-append-expected.txt (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-duration-after-append-expected.txt 2013-12-18 00:57:44 UTC (rev 160739)
@@ -0,0 +1,11 @@
+
+EVENT(sourceopen)
+RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock"))
+RUN(sourceBuffer.appendBuffer(initSegment))
+EVENT(updateend)
+EXPECTED (video.duration == '0') OK
+RUN(sourceBuffer.appendBuffer(sample))
+EVENT(updateend)
+EXPECTED (video.duration == '10') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/media-source/media-source-duration-after-append.html (0 => 160739)
--- trunk/LayoutTests/media/media-source/media-source-duration-after-append.html (rev 0)
+++ trunk/LayoutTests/media/media-source/media-source-duration-after-append.html 2013-12-18 00:57:44 UTC (rev 160739)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>mock-media-source</title>
+ <script src=""
+ <script src=""
+ <script>
+ var source;
+ var sourceBuffer;
+ var initSegment;
+ var sample;
+
+ if (window.internals)
+ internals.initializeMockMediaSource();
+
+ function runTest() {
+ findMediaElement();
+
+ source = new MediaSource();
+ waitForEventOn(source, 'sourceopen', sourceOpen);
+ video.src = ""
+ }
+
+ function sourceOpen() {
+ run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
+ waitForEventOn(sourceBuffer, 'updateend', loadSamples, false, true);
+ initSegment = makeAInit(0, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
+ run('sourceBuffer.appendBuffer(initSegment)');
+ }
+
+ function loadSamples() {
+ testExpected('video.duration', 0);
+ sample = makeASample(0, 0, 10, 1, SAMPLE_FLAG.SYNC);
+ waitForEventOn(sourceBuffer, 'updateend', checkDuration, false, true);
+ run('sourceBuffer.appendBuffer(sample)');
+ }
+
+ function checkDuration() {
+ testExpected('video.duration', 10);
+ endTest();
+ }
+
+ </script>
+</head>
+<body _onload_="runTest()">
+ <video></video>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (160738 => 160739)
--- trunk/Source/WebCore/ChangeLog 2013-12-18 00:56:39 UTC (rev 160738)
+++ trunk/Source/WebCore/ChangeLog 2013-12-18 00:57:44 UTC (rev 160739)
@@ -1,5 +1,23 @@
2013-12-17 Jer Noble <[email protected]>
+ [MSE] Update duration after appending samples, per spec.
+ https://bugs.webkit.org/show_bug.cgi?id=125703
+
+ Reviewed by Eric Carlson.
+
+ Test: media/media-source/media-source-duration-after-append.html
+
+ After appending a sample, update the MediaSource duration if the sample's
+ presentation end time is greater than the existing duration.
+
+ * Modules/mediasource/SourceBuffer.cpp:
+ (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+ (WebCore::MediaSourcePrivateAVFObjC::setDuration): Notify the MediaPlayer.
+
+2013-12-17 Jer Noble <[email protected]>
+
[MSE][Mac] Null-deref in CMSampleBufferIsRandomAccess().
https://bugs.webkit.org/show_bug.cgi?id=125698
Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (160738 => 160739)
--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2013-12-18 00:56:39 UTC (rev 160738)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp 2013-12-18 00:57:44 UTC (rev 160739)
@@ -1001,6 +1001,13 @@
break;
} while (1);
+
+ // Steps 2-4 will be handled by MediaSource::monitorSourceBuffers()
+
+ // 5. If the media segment contains data beyond the current duration, then run the duration change algorithm with new
+ // duration set to the maximum of the current duration and the highest end timestamp reported by HTMLMediaElement.buffered.
+ if (highestPresentationEndTimestamp().toDouble() > m_source->duration())
+ m_source->setDuration(highestPresentationEndTimestamp().toDouble(), IgnorableExceptionCode());
}
bool SourceBuffer::sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (160738 => 160739)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2013-12-18 00:56:39 UTC (rev 160738)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h 2013-12-18 00:57:44 UTC (rev 160739)
@@ -60,6 +60,7 @@
void seekInternal(double, double, double);
void setLoadingProgresssed(bool flag) { m_loadingProgressed = flag; }
void setHasAvailableVideoFrame(bool flag) { m_hasAvailableVideoFrame = flag; }
+ void durationChanged();
private:
// MediaPlayerPrivateInterface
@@ -136,7 +137,6 @@
void ensureLayer();
void destroyLayer();
- void durationChanged();
// MediaPlayer Factory Methods
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (160738 => 160739)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2013-12-18 00:56:39 UTC (rev 160738)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2013-12-18 00:57:44 UTC (rev 160739)
@@ -99,6 +99,7 @@
return;
m_duration = duration;
+ m_player->durationChanged();
}
void MediaSourcePrivateAVFObjC::markEndOfStream(EndOfStreamStatus status)