RESOLVED FIXED 86113
Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress()
https://bugs.webkit.org/show_bug.cgi?id=86113
Summary Replace WebMediaPlayer::bytesLoaded() with an explicit didLoadingProgress()
Ami Fischman
Reported 2012-05-10 10:46:09 PDT
Today WebMediaPlayer::bytesLoaded() is used only to detect loading progress happening (in HTMLMediaElement::changeNetworkStateFromLoadingToIdle()). Instead, WebMediaPlayer could expose a bool didLoadingProgress(); method that returned whether loading progress happened since the last time this function was called. This would allow simplifying WMP implementations that don't otherwise need to track counts of bytes buffered. (I hear scherkus/eric.carlson/acolwell discussed this f2f; feel free to add color to this bug if there's more to it that I missed)
Attachments
Patch (26.07 KB, patch)
2012-05-31 00:36 PDT, Ami Fischman
no flags
Patch (26.05 KB, patch)
2012-05-31 00:55 PDT, Ami Fischman
no flags
Patch (26.22 KB, patch)
2012-05-31 09:07 PDT, Ami Fischman
no flags
Patch (26.19 KB, patch)
2012-05-31 09:26 PDT, Ami Fischman
eric.carlson: review+
webkit.review.bot: commit-queue-
Andrew Scherkus
Comment 1 2012-05-10 10:56:52 PDT
Yeah the idea was to let ports have more choice in deciding what the definition of "progress" is. There are a few options: 1) Monitor changes in buffered() TimeRanges (would this be sufficient?) 2) Ask ports for a loading percentage (a more abstract version of what we have today) 3) Ask ports a "did you progress since the last time I asked you?" method (what you propose here) While (3) is a bit more complex I believe the added flexibility is warranted here. Monitoring changes in buffered() as well as a load percentage assumes that the underlying port is actually buffering. For example, what would a port report in (1) and (2) if it was an infinite live stream?
Philippe Normand
Comment 2 2012-05-10 11:23:56 PDT
bytesLoaded() is also used in HTMLMediaElement::progressEventTimerFired() BTW. Anyway yes, this change proposed by Ami seems like a good approach to me.
Ami Fischman
Comment 3 2012-05-31 00:36:45 PDT
WebKit Review Bot
Comment 4 2012-05-31 00:39:28 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.
Early Warning System Bot
Comment 5 2012-05-31 00:44:02 PDT
Early Warning System Bot
Comment 6 2012-05-31 00:46:41 PDT
Build Bot
Comment 7 2012-05-31 00:53:40 PDT
Ami Fischman
Comment 8 2012-05-31 00:55:10 PDT
Eric Carlson
Comment 9 2012-05-31 08:05:30 PDT
Comment on attachment 145010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145010&action=review > Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:374 > + unsigned currentMaxTimeLoaded = maxTimeLoaded(); "unsigned"? Do you really only want to report loading progress once every second? > Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:375 > + bool ret = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; "ret"? Be bold, use a few more letters and spell out the name of the variable ;-)
Ami Fischman
Comment 10 2012-05-31 09:07:28 PDT
Ami Fischman
Comment 11 2012-05-31 09:08:44 PDT
Comment on attachment 145010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145010&action=review >> Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:374 >> + unsigned currentMaxTimeLoaded = maxTimeLoaded(); > > "unsigned"? Do you really only want to report loading progress once every second? Nope; that was a bug. Fixed. >> Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:375 >> + bool ret = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; > > "ret"? Be bold, use a few more letters and spell out the name of the variable ;-) On your head be it when the Character Availability Crisis of 2012 hits webkit-dev worldwide!
Eric Carlson
Comment 12 2012-05-31 09:21:49 PDT
Comment on attachment 145099 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145099&action=review This looks correct to me. Not marking r+ pending review by abarth, dglazkov, fishd, jamesr, or tkent. > Source/WebCore/html/HTMLMediaElement.cpp:1850 > + } else { > + if (timedelta > 3.0 && !m_sentStalledEvent) { Nit: this could be made into an "else if ( ... ) { "
Eric Carlson
Comment 13 2012-05-31 09:22:30 PDT
(In reply to comment #11) > (From update of attachment 145010 [details]) > >> Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:375 > >> + bool ret = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress; > > > > "ret"? Be bold, use a few more letters and spell out the name of the variable ;-) > > On your head be it when the Character Availability Crisis of 2012 hits webkit-dev worldwide! Oh dear, now I am in for it!
Ami Fischman
Comment 14 2012-05-31 09:26:12 PDT
Comment on attachment 145099 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145099&action=review >> Source/WebCore/html/HTMLMediaElement.cpp:1850 >> + if (timedelta > 3.0 && !m_sentStalledEvent) { > > Nit: this could be made into an "else if ( ... ) { " Done.
Ami Fischman
Comment 15 2012-05-31 09:26:36 PDT
Dimitri Glazkov (Google)
Comment 16 2012-05-31 09:29:59 PDT
Comment on attachment 145104 [details] Patch Chromium WebKit API changes LGTM.
WebKit Review Bot
Comment 17 2012-05-31 11:00:17 PDT
Comment on attachment 145104 [details] Patch Rejecting attachment 145104 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: webkit-commit-queue/Source/WebKit/chromium/webkit --revision 139747 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' 48>At revision 139747. ________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' ________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' Updating webkit projects from gyp files... Full output: http://queues.webkit.org/results/12866281
Ami Fischman
Comment 18 2012-05-31 11:03:38 PDT
WebKit Review Bot
Comment 19 2012-05-31 14:06:49 PDT
Re-opened since this is blocked by 88007
Note You need to log in before you can comment on or make changes to this bug.