LayoutTests/ChangeLog

 12014-12-15 Bartlomiej Gajda <b.gajda@samsung.com>
 2
 3 [MSE] Implement Append Error algorithm.
 4 https://bugs.webkit.org/show_bug.cgi?id=139439
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 If Source Buffer has not received first init segment, then it shall call endOfStream after receiving
 9 Media Segment, as per Media Source spec. (from 17 July 2014) in paragraph 3.5.1 point 6.1.
 10 Added test which after creating SourceBuffer sends media sample, without any init segments.
 11
 12 * media/media-source/media-source-append-media-segment-without-init-expected.txt: Added.
 13 * media/media-source/media-source-append-media-segment-without-init.html: Added.
 14
1152014-12-12 Alexey Proskuryakov <ap@apple.com>
216
317 [WebGL] Texture size tests failures

LayoutTests/media/media-source/media-source-append-media-segment-without-init-expected.txt

 1
 2RUN(video.src = URL.createObjectURL(source))
 3EVENT(sourceopen)
 4RUN(sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock"))
 5RUN(sourceBuffer.appendBuffer(samples))
 6EVENT(error)
 7END OF TEST
 8

LayoutTests/media/media-source/media-source-append-media-segment-without-init.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4 <title>mock-media-source</title>
 5 <script src="mock-media-source.js"></script>
 6 <script src="../video-test.js"></script>
 7 <script>
 8 var source;
 9 var sourceBuffer;
 10 var initSegment;
 11 var wasError = false;
 12
 13 if (window.internals)
 14 internals.initializeMockMediaSource();
 15
 16 function runTest() {
 17 findMediaElement();
 18
 19 source = new MediaSource();
 20 waitForEventOn(source, 'sourceopen', sourceOpen, false, true);
 21 run('video.src = URL.createObjectURL(source)');
 22 }
 23
 24 function sourceOpen() {
 25 run('sourceBuffer = source.addSourceBuffer("video/mock; codecs=mock")');
 26
 27 // Note: In normal usage we should send this line, but this tests what happens without.
 28 // initSegment = makeAInit(0, [makeATrack(1, 'mock', TRACK_KIND.VIDEO)]);
 29
 30 samples = concatenateSamples([
 31 makeASample(0, 0, 1, 1, SAMPLE_FLAG.SYNC),
 32 makeASample(1, 1, 1, 1, SAMPLE_FLAG.NONE),
 33 ]);
 34
 35 // Note: if code correctly handles sample without init, it will go through Segment Parser Loop
 36 // if not, we will receive update event as part of Coded Frame Processing
 37 waitForEventOn(sourceBuffer, 'error', null, true, true);
 38 failTestIn(2000);
 39
 40 run('sourceBuffer.appendBuffer(samples)');
 41 }
 42
 43 </script>
 44</head>
 45<body onload="runTest()">
 46 <video></video>
 47</body>
 48</html>

Source/WebCore/ChangeLog

 12014-12-15 Bartlomiej Gajda <b.gajda@samsung.com>
 2
 3 [MSE] Implement Append Error algorithm.
 4 https://bugs.webkit.org/show_bug.cgi?id=139439
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 If Source Buffer has not received first init segment, then it shall call endOfStream after receiving
 9 Media Segment, as per Media Source spec. (from 17 July 2014) in paragraph 3.5.1 point 6.1.
 10 Based this on Editor's Draft 12 December 2014, as it clarifies order of events.
 11
 12 Test: media/media-source/media-source-append-media-segment-without-init.html
 13
 14 * Modules/mediasource/MediaSource.cpp:
 15 (WebCore::MediaSource::streamEndedWithError):
 16 * Modules/mediasource/MediaSource.h:
 17 * Modules/mediasource/SourceBuffer.cpp:
 18 (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete):
 19 (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
 20 (WebCore::SourceBuffer::validateInitializationSegment):
 21 (WebCore::SourceBuffer::appendError):
 22 * Modules/mediasource/SourceBuffer.h:
 23
1242014-12-12 Mark Rowe <mrowe@apple.com>
225
326 [Mac] Work around a bug in dsymutil on older OS versions

Source/WebCore/Modules/mediasource/SourceBuffer.cpp

@@void SourceBuffer::sourceBufferPrivateAppendComplete(SourceBufferPrivate*, Appen
536536 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-buffer-append
537537
538538 // 2. If the input buffer contains bytes that violate the SourceBuffer byte stream format specification,
539  // then run the end of stream algorithm with the error parameter set to "decode" and abort this algorithm.
 539 // then run the append error algorithm with the decode error parameter set to true and abort this algorithm.
540540 if (result == ParsingFailed) {
541541 LOG(MediaSource, "SourceBuffer::sourceBufferPrivateAppendComplete(%p) - result = ParsingFailed", this);
542  m_source->streamEndedWithError(decodeError(), IgnorableExceptionCode());
 542 appendError(true);
543543 return;
544544 }
545545

@@void SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment(SourceBuff
929929 m_source->setDurationInternal(newDuration);
930930 }
931931
932  // 2. If the initialization segment has no audio, video, or text tracks, then run the end of stream
933  // algorithm with the error parameter set to "decode" and abort these steps.
 932 // 2. If the initialization segment has no audio, video, or text tracks, then run the append error algorithm
 933 // with the decode error parameter set to true and abort these steps.
934934 if (!segment.audioTracks.size() && !segment.videoTracks.size() && !segment.textTracks.size())
935  m_source->streamEndedWithError(decodeError(), IgnorableExceptionCode());
 935 appendError(true);
936936
937937
938938 // 3. If the first initialization segment flag is true, then run the following steps:
939939 if (m_receivedFirstInitializationSegment) {
940940 if (!validateInitializationSegment(segment)) {
941  m_source->streamEndedWithError(decodeError(), IgnorableExceptionCode());
 941 appendError(true);
942942 return;
943943 }
944944 // 3.2 Add the appropriate track descriptions from this initialization segment to each of the track buffers.

@@bool SourceBuffer::validateInitializationSegment(const InitializationSegment& se
11411141 // 3.5.7 Initialization Segment Received (ctd)
11421142 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-init-segment-received
11431143
1144  // 3.1. Verify the following properties. If any of the checks fail then run the end of stream
1145  // algorithm with the error parameter set to "decode" and abort these steps.
 1144 // 3.1. Verify the following properties. If any of the checks fail then run the append error algorithm
 1145 // with the decode error parameter set to true and abort these steps.
11461146 // * The number of audio, video, and text tracks match what was in the first initialization segment.
11471147 if (segment.audioTracks.size() != audioTracks()->length()
11481148 || segment.videoTracks.size() != videoTracks()->length()

@@public:
12091209 }
12101210};
12111211
 1212void SourceBuffer::appendError(bool decodeErrorParam)
 1213{
 1214 // 3.5.3 Append Error Algorithm
 1215 ASSERT(m_updating);
 1216 // 1. Run the reset parser state algorithm.
 1217 resetParserState();
 1218
 1219 // 2. Set the updating attribute to false.
 1220 m_updating = false;
 1221
 1222 // 3. Queue a task to fire a simple event named error at this SourceBuffer object.
 1223 scheduleEvent(eventNames().errorEvent);
 1224
 1225 // 4. Queue a task to fire a simple event named updateend at this SourceBuffer object.
 1226 scheduleEvent(eventNames().updateendEvent);
 1227
 1228 // 5. If decode error is true, then run the end of stream algorithm with the error parameter set to "decode".
 1229 if (decodeErrorParam)
 1230 m_source->streamEndedWithError(decodeError(), IgnorableExceptionCode());
 1231}
 1232
12121233void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample> prpSample)
12131234{
12141235 if (isRemoved())
12151236 return;
12161237
 1238 // 3.5.1 Segment Parser Loop
 1239 // 6.1 If the first initialization segment received flag is false, then run the append error algorithm
 1240 // with the decode error parameter set to true and abort this algorithm.
 1241 // Note: current design makes SourceBuffer somehow ignorant of append state - it's more a thing
 1242 // of SourceBufferPrivate. That's why this check can't really be done in appendInternal.
 1243 // unless we force some kind of design with state machine switching.
 1244 if (!m_receivedFirstInitializationSegment) {
 1245 appendError(true);
 1246 return;
 1247 }
 1248
12171249 RefPtr<MediaSample> sample = prpSample;
12181250
12191251 // 3.5.8 Coded Frame Processing

Source/WebCore/Modules/mediasource/SourceBuffer.h

@@public:
8080 void remove(double start, double end, ExceptionCode&);
8181 void remove(const MediaTime&, const MediaTime&, ExceptionCode&);
8282
 83 void appendError(bool);
8384 void abortIfUpdating();
8485 void removedFromMediaSource();
8586 void seekToTime(const MediaTime&);