WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
95149
Add the duration attribute to MediaSource
https://bugs.webkit.org/show_bug.cgi?id=95149
Summary
Add the duration attribute to MediaSource
Victoria Kirst
Reported
2012-08-27 15:59:52 PDT
Add the duration attribute to MediaSource
Attachments
Patch
(23.19 KB, patch)
2012-08-27 16:14 PDT
,
Victoria Kirst
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from gce-cr-linux-04
(547.75 KB, application/zip)
2012-08-27 17:52 PDT
,
WebKit Review Bot
no flags
Details
Patch
(23.09 KB, patch)
2012-08-29 13:29 PDT
,
Victoria Kirst
no flags
Details
Formatted Diff
Diff
Patch
(22.11 KB, patch)
2012-08-29 15:40 PDT
,
Victoria Kirst
no flags
Details
Formatted Diff
Diff
Patch
(22.69 KB, patch)
2012-09-05 07:58 PDT
,
Victoria Kirst
no flags
Details
Formatted Diff
Diff
Patch
(22.70 KB, patch)
2012-09-05 08:03 PDT
,
Victoria Kirst
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Victoria Kirst
Comment 1
2012-08-27 16:14:58 PDT
Created
attachment 160845
[details]
Patch
WebKit Review Bot
Comment 2
2012-08-27 16:18:31 PDT
Please wait for approval from
abarth@webkit.org
,
dglazkov@chromium.org
,
fishd@chromium.org
,
jamesr@chromium.org
or
tkent@chromium.org
before submitting, as this patch contains changes to the Chromium public API. See also
https://trac.webkit.org/wiki/ChromiumWebKitAPI
.
WebKit Review Bot
Comment 3
2012-08-27 17:51:57 PDT
Comment on
attachment 160845
[details]
Patch
Attachment 160845
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/13646126
New failing tests: http/tests/media/media-source/video-media-source-duration-changed.html
WebKit Review Bot
Comment 4
2012-08-27 17:52:00 PDT
Created
attachment 160871
[details]
Archive of layout-test-results from gce-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Victoria Kirst
Comment 5
2012-08-27 17:53:08 PDT
Ah right, this needs a Chromium-side CL to land before the test will pass!
Dimitri Glazkov (Google)
Comment 6
2012-08-29 10:39:16 PDT
Comment on
attachment 160845
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=160845&action=review
> Source/WebCore/Modules/mediasource/MediaSource.cpp:73 > + if (m_readyState == closedKeyword()) > + return std::numeric_limits<float>::quiet_NaN(); > + > + return m_player->duration();
This can be just a ternary if.
> Source/WebCore/Modules/mediasource/MediaSource.idl:47 > + attribute double duration > + setter raises (DOMException);
Why u break line?
> Source/WebCore/html/HTMLMediaElement.cpp:3260 > + if (now > dur)
dur->duration.
> LayoutTests/http/tests/media/media-source/media-source.js:325 > + if (!this.floatingPointEquals_(expected, videoTag.duration)) > + {
Move brace to same line
> LayoutTests/http/tests/media/media-source/media-source.js:329 > + {
Ditto.
> LayoutTests/http/tests/media/media-source/media-source.js:337 > + {
Ditto.
> LayoutTests/http/tests/media/media-source/media-source.js:342 > + {
Ditto.
> LayoutTests/http/tests/media/media-source/media-source.js:349 > + {
Ditto.
> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:127 > + {
Ditto.
Eric Carlson
Comment 7
2012-08-29 11:09:42 PDT
Comment on
attachment 160845
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=160845&action=review
> Source/WebCore/html/HTMLMediaElement.cpp:3261 > + if (now > dur) > + seek(dur, ignoredException);
Why is this necessary?
> LayoutTests/http/tests/media/media-source/media-source.js:317 > +MediaSourceTest.floatingPointEquals_ = function(expected, actual) {
Move brace to new line (take that Dimitri).
> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:11 > + function expectExceptionOnSetDuration(value, error) {
Ditto.
> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:35 > + if (!isNaN(mediaSource.duration)) { > + failTest("Unexpected duration value. Expected NaN got " + mediaSource.duration); > + }
Braces are not necessary.
Victoria Kirst
Comment 8
2012-08-29 13:29:01 PDT
Comment on
attachment 160845
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=160845&action=review
>> Source/WebCore/Modules/mediasource/MediaSource.cpp:73 >> + return m_player->duration(); > > This can be just a ternary if.
Done.
>> Source/WebCore/Modules/mediasource/MediaSource.idl:47 >> + setter raises (DOMException); > > Why u break line?
I was just following what Big Bro HTMLMediaElement.idl did :( Changed to one line!
>> Source/WebCore/html/HTMLMediaElement.cpp:3260 >> + if (now > dur) > > dur->duration.
Can't do that because then you get "float duration = duration()" which doesn't compile. Kept the same because "dur = duration()" is used in other areas of the class as well? Can change to something different if you'd like.
>> Source/WebCore/html/HTMLMediaElement.cpp:3261 >> + seek(dur, ignoredException); > > Why is this necessary?
Here I'm trying to follow the part of the spec regarding duration change: "If the duration is changed such that the current playback position ends up being greater than the time of the end of the media resource, then the user agent must also seek the to the time of the end of the media resource." (
http://dev.w3.org/html5/spec/media-elements.html#durationChange
, linked from
http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#duration-change-algorithm
) I wasn't very confident in this part of the change, so let me know if you'd prefer me to do this in a different way.
>> LayoutTests/http/tests/media/media-source/media-source.js:317 >> +MediaSourceTest.floatingPointEquals_ = function(expected, actual) { > > Move brace to new line (take that Dimitri).
:) done.
>> LayoutTests/http/tests/media/media-source/media-source.js:325 >> + { > > Move brace to same line
Removed braces instead.
>> LayoutTests/http/tests/media/media-source/media-source.js:329 >> + { > > Ditto.
Removed braces instead.
>> LayoutTests/http/tests/media/media-source/media-source.js:337 >> + { > > Ditto.
Removed braches instead.
>> LayoutTests/http/tests/media/media-source/media-source.js:342 >> + { > > Ditto.
Done.
>> LayoutTests/http/tests/media/media-source/media-source.js:349 >> + { > > Ditto.
Done.
>> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:11 >> + function expectExceptionOnSetDuration(value, error) { > > Ditto.
Done.
>> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:35 >> + } > > Braces are not necessary.
Fixed here and in a few other places where I had braces around a one-liner.
>> LayoutTests/http/tests/media/media-source/video-media-source-duration-changed.html:127 >> + { > > Ditto.
Done.
Victoria Kirst
Comment 9
2012-08-29 13:29:29 PDT
Created
attachment 161299
[details]
Patch
Eric Carlson
Comment 10
2012-08-29 15:01:52 PDT
(In reply to
comment #8
)
> (From update of
attachment 160845
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=160845&action=review
> >> Source/WebCore/html/HTMLMediaElement.cpp:3261 > >> + seek(dur, ignoredException); > > > > Why is this necessary? > > Here I'm trying to follow the part of the spec regarding duration change: > "If the duration is changed such that the current playback position ends up being greater than the time of the end of the media resource, then the user agent must also seek the to the time of the end of the media resource." > (
http://dev.w3.org/html5/spec/media-elements.html#durationChange
, linked from
http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#duration-change-algorithm
) > > I wasn't very confident in this part of the change, so let me know if you'd prefer me to do this in a different way. >
I see. This is a good change, but it should be done in a separate patch because it has nothing to do with the rest of these changes.
Victoria Kirst
Comment 11
2012-08-29 15:40:23 PDT
Created
attachment 161336
[details]
Patch
Victoria Kirst
Comment 12
2012-08-29 15:42:22 PDT
> I see. This is a good change, but it should be done in a separate patch because it has nothing to do with the rest of these changes.
Good point. Reverted the HTMLMediaElement change and will add to a separate patch!
Eric Carlson
Comment 13
2012-08-29 16:31:31 PDT
Comment on
attachment 161336
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=161336&action=review
> Source/WebCore/ChangeLog:16 > + * Modules/mediasource/MediaSource.cpp: > + (WebCore::MediaSource::duration): > + (WebCore): > + (WebCore::MediaSource::setDuration):
Nit: I think it is helpful to have comments about what changed in each function in a ChangeLog entry.
> Source/WebCore/Modules/mediasource/MediaSource.cpp:71 > + return m_readyState == closedKeyword() ? > + std::numeric_limits<float>::quiet_NaN() : m_player->duration();
Nit: I don't think the line break aids readability here.
> LayoutTests/http/tests/media/media-source/media-source.js:142 > + for (var index = 0; index < this.mediaSegments.length; index++)
Nit: you use "index" here and "i" elsewhere.
> LayoutTests/http/tests/media/media-source/media-source.js:321 > +MediaSourceTest.floatingPointEquals_ = function(expected, actual) > +{ > + var delta = Math.abs(actual - expected); > + return delta < 0.01; > +};
Why does the function name end with an underscore? What makes 0.01 an acceptable delta?
Dimitri Glazkov (Google)
Comment 14
2012-08-29 19:45:54 PDT
(In reply to
comment #7
)
> > LayoutTests/http/tests/media/media-source/media-source.js:317 > > +MediaSourceTest.floatingPointEquals_ = function(expected, actual) { > > Move brace to new line (take that Dimitri).
Nooooooo... (fades away)...ooo.....
WebKit Review Bot
Comment 15
2012-08-29 23:32:04 PDT
Comment on
attachment 161336
[details]
Patch
Attachment 161336
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/13684579
New failing tests: http/tests/media/media-source/video-media-source-duration-changed.html
Aaron Colwell
Comment 16
2012-08-30 08:54:20 PDT
(In reply to
comment #15
)
> (From update of
attachment 161336
[details]
) >
Attachment 161336
[details]
did not pass chromium-ews (chromium-xvfb): > Output:
http://queues.webkit.org/results/13684579
> > New failing tests: > http/tests/media/media-source/video-media-source-duration-changed.html
This is likely failing because this patch landed first (
https://bugs.webkit.org/show_bug.cgi?id=95247
). I think you just need to change your "new MediaSource()" to "new WebKitMediaSource()".
Victoria Kirst
Comment 17
2012-09-05 07:58:28 PDT
Created
attachment 162248
[details]
Patch
Victoria Kirst
Comment 18
2012-09-05 08:03:47 PDT
Created
attachment 162251
[details]
Patch
Victoria Kirst
Comment 19
2012-09-05 08:05:20 PDT
Comment on
attachment 161336
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=161336&action=review
>> Source/WebCore/ChangeLog:16 >> + (WebCore::MediaSource::setDuration): > > Nit: I think it is helpful to have comments about what changed in each function in a ChangeLog entry.
Done.
>> Source/WebCore/Modules/mediasource/MediaSource.cpp:71 >> + std::numeric_limits<float>::quiet_NaN() : m_player->duration(); > > Nit: I don't think the line break aids readability here.
Line break removed.
>> LayoutTests/http/tests/media/media-source/media-source.js:142 >> + for (var index = 0; index < this.mediaSegments.length; index++) > > Nit: you use "index" here and "i" elsewhere.
Changed.
>> LayoutTests/http/tests/media/media-source/media-source.js:321 >> +}; > > Why does the function name end with an underscore? > > What makes 0.01 an acceptable delta?
> Why does the function name end with an underscore?
To match the other "private" functions for MediaSourceTest, like runNext_.
> What makes 0.01 an acceptable delta?
Hmmm, thinking about this again, comparing against an arbitrary delta doesn't make sense. The manifest file presents timestamps rounded to 3 decimal places, but the actual file timestamps are of course unrounded, hence the discrepancy. Makes a lot more sense to just round the timestamps to 3 decimal places. Updated test to do that instead.
WebKit Review Bot
Comment 20
2012-09-05 18:58:12 PDT
Comment on
attachment 162251
[details]
Patch Clearing flags on attachment: 162251 Committed
r127675
: <
http://trac.webkit.org/changeset/127675
>
WebKit Review Bot
Comment 21
2012-09-05 18:58:17 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug