Changeset 205820 in webkit
- Timestamp:
- Sep 12, 2016 2:09:15 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205815 r205820 1 2016-09-12 Jer Noble <jer.noble@apple.com> 2 3 Fix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html tests 4 https://bugs.webkit.org/show_bug.cgi?id=161819 5 6 Reviewed by Eric Carlson. 7 8 * media/media-source/media-source-end-of-stream-readyState.html: 9 * media/media-source/media-source-end-of-stream-readyState-expected.txt: 10 * platform/mac/TestExpectations: 11 1 12 2016-09-12 Matt Baker <mattbaker@apple.com> 2 13 -
trunk/LayoutTests/media/media-source/media-source-end-of-stream-readyState-expected.txt
r179044 r205820 9 9 RUN(source.endOfStream()) 10 10 EXPECTED (source.duration.toFixed(3) == '5') OK 11 E VENT(updateend)11 EXPECTED (sourceBuffer.updating == 'false') OK 12 12 END OF TEST 13 13 -
trunk/LayoutTests/media/media-source/media-source-end-of-stream-readyState.html
r179044 r205820 37 37 38 38 waitForEventOn(source, 'sourceopen', function() { failTest("Should not transit to 'open' state during endOfStream().") }, false, true); 39 waitForEventOn(sourceBuffer, 'updateend', endTest, false, true);40 39 run('source.endOfStream()'); 41 40 testExpected('source.duration.toFixed(3)', 5); 41 testExpected('sourceBuffer.updating', false); 42 endTest(); 42 43 } 43 44 -
trunk/LayoutTests/platform/mac/TestExpectations
r205777 r205820 1048 1048 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/SourceBuffer-abort.html [ Pass ] 1049 1049 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-closed.html [ Pass ] 1050 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html [ Pass ] 1050 1051 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html [ Pass ] 1051 1052 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-multiple-attach.html [ Pass ] 1053 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-play.html [ Pass ] 1052 1054 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-sourcebufferlist.html [ Pass ] 1053 1055 … … 1061 1063 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-v-bitrate.html [ Failure ] 1062 1064 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html [ Failure ] 1063 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-play.html [ Failure ]1064 1065 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-remove.html [ Failure ] 1065 1066 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r205818 r205820 1 2016-09-12 Jer Noble <jer.noble@apple.com> 2 3 Fix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html tests 4 https://bugs.webkit.org/show_bug.cgi?id=161819 5 6 Reviewed by Eric Carlson. 7 8 Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-play.html 9 imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html 10 11 The newest revision of the web-platform-test suite for Media Source tests new behavior 12 added to the MSE specification. Specifically, setting a MediaSource's duration will no 13 longer implicitly truncate the source's active SourceBuffer objects. 14 15 * Modules/mediasource/MediaSource.cpp: 16 (WebCore::MediaSource::setDuration): Return exception if issued by setDurationInternal. 17 (WebCore::MediaSource::setDurationInternal): Bring "duration change" algorithm up to spec. 18 * Modules/mediasource/MediaSource.h: 19 * Modules/mediasource/SampleMap.h: 20 (WebCore::PresentationOrderSampleMap::begin): Add const accessor. 21 (WebCore::PresentationOrderSampleMap::end): Ditto. 22 (WebCore::PresentationOrderSampleMap::rbegin): Ditto. 23 (WebCore::PresentationOrderSampleMap::rend): DItto. 24 (WebCore::DecodeOrderSampleMap::begin): Ditto. 25 (WebCore::DecodeOrderSampleMap::end): Ditto. 26 (WebCore::DecodeOrderSampleMap::rbegin): Ditto. 27 (WebCore::DecodeOrderSampleMap::rend): Ditto. 28 * Modules/mediasource/SourceBuffer.cpp: 29 (WebCore::SourceBuffer::highestPresentationTimestamp): Added convenience method. 30 (WebCore::SourceBuffer::removeCodedFrames): Drive-by fix; use .values() rather than 31 pulling the value out of each HashMap iterator. 32 * Modules/mediasource/SourceBuffer.h: 33 1 34 2016-09-12 Chris Dumez <cdumez@apple.com> 2 35 -
trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp
r202105 r205820 358 358 359 359 // 4. Run the duration change algorithm with new duration set to the value being assigned to this attribute. 360 setDurationInternal(MediaTime::createWithDouble(duration)); 361 } 362 363 void MediaSource::setDurationInternal(const MediaTime& duration) 364 { 365 // Duration Change Algorithm 366 // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#duration-change-algorithm 360 auto result = setDurationInternal(MediaTime::createWithDouble(duration)); 361 if (result) 362 ec = result.value(); 363 } 364 365 Optional<ExceptionCode> MediaSource::setDurationInternal(const MediaTime& duration) 366 { 367 // 2.4.6 Duration Change 368 // https://rawgit.com/w3c/media-source/45627646344eea0170dd1cbc5a3d508ca751abb8/media-source-respec.html#duration-change-algorithm 369 370 MediaTime newDuration = duration; 367 371 368 372 // 1. If the current value of duration is equal to new duration, then return. 369 if (duration == m_duration) 370 return; 371 372 // 2. Set old duration to the current value of duration. 373 MediaTime oldDuration = m_duration; 374 375 // 3. Update duration to new duration. 376 m_duration = duration; 377 378 // 4. If the new duration is less than old duration, then call remove(new duration, old duration) 379 // on all objects in sourceBuffers. 380 if (oldDuration.isValid() && duration < oldDuration) { 381 for (auto& sourceBuffer : *m_sourceBuffers) 382 sourceBuffer->rangeRemoval(duration, oldDuration); 383 } 384 385 // 5. If a user agent is unable to partially render audio frames or text cues that start before and end after the 386 // duration, then run the following steps: 387 // 5.1 Update new duration to the highest end time reported by the buffered attribute across all SourceBuffer objects 388 // in sourceBuffers. 389 // 5.2 Update duration to new duration. 390 // NOTE: Assume UA is able to partially render audio frames. 391 392 // 6. Update the media controller duration to new duration and run the HTMLMediaElement duration change algorithm. 373 if (newDuration == m_duration) 374 return { }; 375 376 // 2. If new duration is less than the highest presentation timestamp of any buffered coded frames 377 // for all SourceBuffer objects in sourceBuffers, then throw an InvalidStateError exception and 378 // abort these steps. 379 // 3. Let highest end time be the largest track buffer ranges end time across all the track buffers 380 // across all SourceBuffer objects in sourceBuffers. 381 MediaTime highestPresentationTimestamp; 382 MediaTime highestEndTime; 383 for (auto& sourceBuffer : *m_sourceBuffers) { 384 highestPresentationTimestamp = std::max(highestPresentationTimestamp, sourceBuffer->highestPresentationTimestamp()); 385 highestEndTime = std::max(highestEndTime, sourceBuffer->buffered()->ranges().maximumBufferedTime()); 386 } 387 if (highestPresentationTimestamp.isValid() && newDuration < highestPresentationTimestamp) 388 return INVALID_STATE_ERR; 389 390 // 4. If new duration is less than highest end time, then 391 // 4.1. Update new duration to equal highest end time. 392 if (highestEndTime.isValid() && newDuration < highestEndTime) 393 newDuration = highestEndTime; 394 395 // 5. Update duration to new duration. 396 m_duration = newDuration; 397 398 // 6. Update the media duration to new duration and run the HTMLMediaElement duration change algorithm. 393 399 LOG(MediaSource, "MediaSource::setDurationInternal(%p) - duration(%g)", this, duration.toDouble()); 394 400 m_private->durationChanged(); 401 402 return { }; 395 403 } 396 404 -
trunk/Source/WebCore/Modules/mediasource/MediaSource.h
r200361 r205820 85 85 86 86 void setDuration(double, ExceptionCode&); 87 voidsetDurationInternal(const MediaTime&);87 Optional<ExceptionCode> setDurationInternal(const MediaTime&); 88 88 MediaTime currentTime() const; 89 89 const AtomicString& readyState() const { return m_readyState; } -
trunk/Source/WebCore/Modules/mediasource/SampleMap.h
r204239 r205820 43 43 typedef std::map<MediaTime, RefPtr<MediaSample>> MapType; 44 44 typedef MapType::iterator iterator; 45 typedef MapType::const_iterator const_iterator; 45 46 typedef MapType::reverse_iterator reverse_iterator; 47 typedef MapType::const_reverse_iterator const_reverse_iterator; 46 48 typedef std::pair<iterator, iterator> iterator_range; 47 49 48 50 iterator begin() { return m_samples.begin(); } 51 const_iterator begin() const { return m_samples.begin(); } 49 52 iterator end() { return m_samples.end(); } 53 const_iterator end() const { return m_samples.end(); } 50 54 reverse_iterator rbegin() { return m_samples.rbegin(); } 55 const_reverse_iterator rbegin() const { return m_samples.rbegin(); } 51 56 reverse_iterator rend() { return m_samples.rend(); } 57 const_reverse_iterator rend() const { return m_samples.rend(); } 52 58 53 59 iterator findSampleWithPresentationTime(const MediaTime&); … … 70 76 typedef std::map<KeyType, RefPtr<MediaSample>> MapType; 71 77 typedef MapType::iterator iterator; 78 typedef MapType::const_iterator const_iterator; 72 79 typedef MapType::reverse_iterator reverse_iterator; 80 typedef MapType::const_reverse_iterator const_reverse_iterator; 73 81 typedef std::pair<reverse_iterator, reverse_iterator> reverse_iterator_range; 74 82 75 83 iterator begin() { return m_samples.begin(); } 84 const_iterator begin() const { return m_samples.begin(); } 76 85 iterator end() { return m_samples.end(); } 86 const_iterator end() const { return m_samples.end(); } 77 87 reverse_iterator rbegin() { return m_samples.rbegin(); } 88 const_reverse_iterator rbegin() const { return m_samples.rbegin(); } 78 89 reverse_iterator rend() { return m_samples.rend(); } 90 const_reverse_iterator rend() const { return m_samples.rend(); } 79 91 80 92 iterator findSampleWithDecodeKey(const KeyType&); -
trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp
r204239 r205820 396 396 } 397 397 398 MediaTime SourceBuffer::highestPresentationTimestamp() const 399 { 400 MediaTime highestTime; 401 for (auto& trackBuffer : m_trackBufferMap.values()) { 402 auto lastSampleIter = trackBuffer.samples.presentationOrder().rbegin(); 403 if (lastSampleIter == trackBuffer.samples.presentationOrder().rend()) 404 continue; 405 highestTime = std::max(highestTime, lastSampleIter->first); 406 } 407 return highestTime; 408 } 409 398 410 void SourceBuffer::removedFromMediaSource() 399 411 { … … 742 754 // 2. Let end be the end presentation timestamp for the removal range. 743 755 // 3. For each track buffer in this source buffer, run the following steps: 744 for (auto& iter : m_trackBufferMap) { 745 TrackBuffer& trackBuffer = iter.value; 746 756 for (auto& trackBuffer : m_trackBufferMap.values()) { 747 757 // 3.1. Let remove end timestamp be the current value of duration 748 758 // 3.2 If this track buffer has a random access point timestamp that is greater than or equal to end, then update -
trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h
r204239 r205820 125 125 void setBufferedDirty(bool flag) { m_bufferedDirty = flag; } 126 126 127 MediaTime highestPresentationTimestamp() const; 128 127 129 // ActiveDOMObject API. 128 130 bool hasPendingActivity() const override;
Note: See TracChangeset
for help on using the changeset viewer.