Changeset 127675 in webkit
- Timestamp:
- Sep 5, 2012 6:58:35 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127673 r127675 1 2012-09-05 Victoria Kirst <vrk@chromium.org> 2 3 Add the duration attribute to MediaSource 4 https://bugs.webkit.org/show_bug.cgi?id=95149 5 6 Reviewed by Eric Carlson. 7 8 Add support for the duration attribute recently added to the MediaSource spec. 9 http://dev.w3.org/html5/spec/media-elements.html#dom-media-duration 10 11 * http/tests/media/media-source/media-source.js: 12 (MediaSourceTest.SegmentHelper): Add parameter to specify whether full file should be loaded. 13 (MediaSourceTest.SegmentHelper.prototype.appendAllMediaSegments): Added method to append all file segments. 14 (MediaSourceTest.roundedEquals_): Added to see if values are equivalent after rounding. 15 (MediaSourceTest.expectDuration): Added to check for expected duration. 16 (MediaSourceTest.expectBufferedRange): Added to check for the expected buffered attribute value. 17 * http/tests/media/media-source/video-media-source-duration-changed-expected.txt: Added. 18 * http/tests/media/media-source/video-media-source-duration-changed.html: Added. 19 1 20 2012-09-05 Kenichi Ishibashi <bashi@chromium.org> 2 21 -
trunk/LayoutTests/http/tests/media/media-source/media-source.js
r127088 r127675 2 2 var mediaSource = new WebKitMediaSource(); 3 3 4 MediaSourceTest.SegmentHelper = function(segmentInfo )4 MediaSourceTest.SegmentHelper = function(segmentInfo, fullDuration) 5 5 { 6 6 this.MediaSegmentsToLoad = 0; … … 15 15 var maxDuration = 3; 16 16 for (var i in this.segmentInfo.media) { 17 if ( this.segmentInfo.media[i].timecode > maxDuration)17 if (!fullDuration && this.segmentInfo.media[i].timecode > maxDuration) 18 18 break; 19 19 this.MediaSegmentsToLoad++; … … 138 138 }; 139 139 140 MediaSourceTest.SegmentHelper.prototype.appendAllMediaSegments = function() 141 { 142 for (var i = 0; i < this.mediaSegments.length; i++) 143 this.appendMediaSegment(i); 144 }; 145 140 146 MediaSourceTest.SegmentHelper.prototype.appendUntilEndOfStream = function(startIndex) 141 147 { … … 309 315 }; 310 316 317 MediaSourceTest.roundedEquals_ = function(expected, actual) 318 { 319 return expected.toFixed(3) == actual.toFixed(3); 320 }; 321 322 MediaSourceTest.expectDuration = function(videoTag, mediaSource, expected) 323 { 324 if (!this.roundedEquals_(expected, videoTag.duration)) 325 failTest("Unexpected duration. Expected " + expected + " got " + videoTag.duration); 326 if (!this.roundedEquals_(expected, mediaSource.duration)) 327 failTest("Unexpected duration. Expected " + expected + " got " + mediaSource.duration); 328 }; 329 330 MediaSourceTest.expectBufferedRange = function(sourceBuffer, expected) 331 { 332 if (sourceBuffer.buffered.length != expected.length) 333 failTest("Unexpected number of buffered regions. Expected " + expected.length + " got " + sourceBuffer.buffered.length); 334 335 for (var i = 0; i < expected.length; i++) { 336 var expectedStart = expected[i][0]; 337 var expectedEnd = expected[i][1]; 338 var actualStart = sourceBuffer.buffered.start(i); 339 var actualEnd = sourceBuffer.buffered.end(i); 340 if (!this.roundedEquals_(expectedStart, actualStart) || 341 !this.roundedEquals_(expectedEnd, actualEnd)) { 342 failTest("Unexpected buffered region. Expected (" + expectedStart + ", " + expectedEnd + ") got (" 343 + actualStart + ", " + actualEnd +")"); 344 } 345 } 346 }; 347 311 348 MediaSourceTest.getReadyStateName = function(state) 312 349 { -
trunk/Source/WebCore/ChangeLog
r127674 r127675 1 2012-09-05 Victoria Kirst <vrk@chromium.org> 2 3 Add the duration attribute to MediaSource 4 https://bugs.webkit.org/show_bug.cgi?id=95149 5 6 Reviewed by Eric Carlson. 7 8 Add support for the duration attribute recently added to the MediaSource spec. 9 http://dev.w3.org/html5/spec/media-elements.html#dom-media-duration 10 11 Test: http/tests/media/media-source/video-media-source-duration-changed.html 12 13 * Modules/mediasource/MediaSource.cpp: 14 (WebCore::MediaSource::duration): Added duration method. 15 (WebCore): 16 (WebCore::MediaSource::setDuration): Added duration setter. 17 * Modules/mediasource/MediaSource.h: 18 (MediaSource): 19 * Modules/mediasource/MediaSource.idl: 20 * platform/graphics/MediaPlayer.cpp: 21 (WebCore::NullMediaPlayerPrivate::sourceSetDuration): Add empty definition. 22 (WebCore::MediaPlayer::sourceSetDuration): Forward call to m_private. 23 (WebCore): 24 * platform/graphics/MediaPlayer.h: 25 * platform/graphics/MediaPlayerPrivate.h: 26 (WebCore::MediaPlayerPrivateInterface::sourceSetDuration): Add empty definition. 27 1 28 2012-09-05 Mihai Parparita <mihaip@chromium.org> 2 29 -
trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp
r127062 r127675 85 85 } 86 86 87 double MediaSource::duration() const 88 { 89 return m_readyState == closedKeyword() ? std::numeric_limits<float>::quiet_NaN() : m_player->duration(); 90 } 91 92 void MediaSource::setDuration(double duration, ExceptionCode& ec) 93 { 94 if (duration < 0.0 || isnan(duration)) { 95 ec = INVALID_ACCESS_ERR; 96 return; 97 } 98 if (m_readyState != openKeyword()) { 99 ec = INVALID_STATE_ERR; 100 return; 101 } 102 m_player->sourceSetDuration(duration); 103 } 104 87 105 SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec) 88 106 { -
trunk/Source/WebCore/Modules/mediasource/MediaSource.h
r127062 r127675 55 55 SourceBufferList* activeSourceBuffers(); 56 56 57 double duration() const; 58 void setDuration(double, ExceptionCode&); 59 57 60 SourceBuffer* addSourceBuffer(const String& type, ExceptionCode&); 58 61 void removeSourceBuffer(SourceBuffer*, ExceptionCode&); -
trunk/Source/WebCore/Modules/mediasource/MediaSource.idl
r124953 r127675 44 44 readonly attribute SourceBufferList activeSourceBuffers; 45 45 46 attribute double duration setter raises (DOMException); 47 46 48 SourceBuffer addSourceBuffer(in DOMString type) raises (DOMException); 47 49 void removeSourceBuffer(in SourceBuffer buffer) raises (DOMException); -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r126157 r127675 155 155 virtual bool sourceAppend(const String&, const unsigned char*, unsigned) { return false; } 156 156 virtual bool sourceAbort(const String&) { return false; } 157 virtual void sourceSetDuration(double) { } 157 158 virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { } 158 159 virtual bool sourceSetTimestampOffset(const String&, double) { return false; } … … 491 492 } 492 493 494 void MediaPlayer::sourceSetDuration(double duration) 495 { 496 m_private->sourceSetDuration(duration); 497 } 498 493 499 void MediaPlayer::sourceEndOfStream(MediaPlayer::EndOfStreamStatus status) 494 500 { -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r127300 r127675 267 267 PassRefPtr<TimeRanges> sourceBuffered(const String& id); 268 268 bool sourceAppend(const String& id, const unsigned char* data, unsigned length); 269 void sourceSetDuration(double); 269 270 bool sourceAbort(const String& id); 270 271 enum EndOfStreamStatus { EosNoError, EosNetworkError, EosDecodeError }; -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r125682 r127675 174 174 virtual bool sourceAppend(const String& id, const unsigned char* data, unsigned length) { return false; } 175 175 virtual bool sourceAbort(const String& id) { return false; } 176 virtual void sourceSetDuration(double) { } 176 177 virtual void sourceEndOfStream(MediaPlayer::EndOfStreamStatus) { }; 177 178 virtual bool sourceSetTimestampOffset(const String& id, double offset) { return false; } -
trunk/Source/WebKit/chromium/ChangeLog
r127674 r127675 1 2012-09-05 Victoria Kirst <vrk@chromium.org> 2 3 Add the duration attribute to MediaSource 4 https://bugs.webkit.org/show_bug.cgi?id=95149 5 6 Reviewed by Eric Carlson. 7 8 Add support for the duration attribute recently added to the MediaSource spec. 9 http://dev.w3.org/html5/spec/media-elements.html#dom-media-duration 10 11 * public/WebMediaPlayer.h: 12 (WebKit::WebMediaPlayer::sourceSetDuration): Add empty definition. 13 * src/WebMediaPlayerClientImpl.cpp: 14 (WebKit::WebMediaPlayerClientImpl::sourceSetDuration): Forward call to m_webMediaPlayer. 15 (WebKit): 16 * src/WebMediaPlayerClientImpl.h: 17 (WebMediaPlayerClientImpl): 18 1 19 2012-09-05 Mihai Parparita <mihaip@chromium.org> 2 20 -
trunk/Source/WebKit/chromium/public/WebMediaPlayer.h
r125682 r127675 187 187 virtual bool sourceAppend(const WebString& id, const unsigned char* data, unsigned length) { return false; } 188 188 virtual bool sourceAbort(const WebString& id) { return false; } 189 virtual void sourceSetDuration(double) { } 189 190 virtual void sourceEndOfStream(EndOfStreamStatus) { } 190 191 virtual bool sourceSetTimestampOffset(const WebString& id, double offset) { return false; } -
trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
r127225 r127675 444 444 } 445 445 446 void WebMediaPlayerClientImpl::sourceSetDuration(double duration) 447 { 448 if (m_webMediaPlayer) 449 m_webMediaPlayer->sourceSetDuration(duration); 450 } 451 446 452 void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus status) 447 453 { -
trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
r127172 r127675 164 164 virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); 165 165 virtual bool sourceAbort(const String&); 166 virtual void sourceSetDuration(double); 166 167 virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); 167 168 virtual bool sourceSetTimestampOffset(const String&, double offset);
Note: See TracChangeset
for help on using the changeset viewer.