Unreviewed, rolling out r119125.
authorrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 21:09:01 +0000 (21:09 +0000)
committerrafaelw@chromium.org <rafaelw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 21:09:01 +0000 (21:09 +0000)
http://trac.webkit.org/changeset/119125
https://bugs.webkit.org/show_bug.cgi?id=88007

Will break android build if rolled (Requested by rafaelw_ on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-05-31

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::startProgressEventTimer):
(WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle):
(WebCore::HTMLMediaElement::progressEventTimerFired):
(WebCore::HTMLMediaElement::startPlaybackProgressTimer):
* platform/graphics/MediaPlayer.cpp:
(WebCore::NullMediaPlayerPrivate::bytesLoaded):
(WebCore::MediaPlayer::bytesLoaded):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(MediaPlayerPrivateInterface):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
(WebCore::MediaPlayerPrivateAVFoundation::bytesLoaded):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(MediaPlayerPrivateAVFoundation):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::bytesLoaded):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::bytesLoaded):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):
* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
(MediaPlayerPrivateQTKit):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit):
(WebCore::MediaPlayerPrivateQTKit::bytesLoaded):
* platform/graphics/qt/MediaPlayerPrivateQt.cpp:
(WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt):
(WebCore::MediaPlayerPrivateQt::bytesLoaded):
* platform/graphics/qt/MediaPlayerPrivateQt.h:
(MediaPlayerPrivateQt):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext):
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::bytesLoaded):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
(MediaPlayerPrivateQuickTimeVisualContext):
* platform/graphics/wince/MediaPlayerPrivateWinCE.h:
(MediaPlayerPrivate):

Source/WebKit/chromium:

* public/WebMediaPlayer.h:
(WebMediaPlayer):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::bytesLoaded):
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119146 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
Source/WebCore/platform/graphics/wince/MediaPlayerPrivateWinCE.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebMediaPlayer.h
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h

index 23bf0e0..f88aae6 100644 (file)
@@ -1,3 +1,56 @@
+2012-05-31  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r119125.
+        http://trac.webkit.org/changeset/119125
+        https://bugs.webkit.org/show_bug.cgi?id=88007
+
+        Will break android build if rolled (Requested by rafaelw_ on
+        #webkit).
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::startProgressEventTimer):
+        (WebCore::HTMLMediaElement::changeNetworkStateFromLoadingToIdle):
+        (WebCore::HTMLMediaElement::progressEventTimerFired):
+        (WebCore::HTMLMediaElement::startPlaybackProgressTimer):
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::NullMediaPlayerPrivate::bytesLoaded):
+        (WebCore::MediaPlayer::bytesLoaded):
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/MediaPlayerPrivate.h:
+        (MediaPlayerPrivateInterface):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
+        (WebCore::MediaPlayerPrivateAVFoundation::bytesLoaded):
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        (MediaPlayerPrivateAVFoundation):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+        (WebCore::MediaPlayerPrivate::bytesLoaded):
+        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+        (MediaPlayerPrivate):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::bytesLoaded):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        (MediaPlayerPrivateQTKit):
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit):
+        (WebCore::MediaPlayerPrivateQTKit::bytesLoaded):
+        * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
+        (WebCore::MediaPlayerPrivateQt::MediaPlayerPrivateQt):
+        (WebCore::MediaPlayerPrivateQt::bytesLoaded):
+        * platform/graphics/qt/MediaPlayerPrivateQt.h:
+        (MediaPlayerPrivateQt):
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext):
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::bytesLoaded):
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h:
+        (MediaPlayerPrivateQuickTimeVisualContext):
+        * platform/graphics/wince/MediaPlayerPrivateWinCE.h:
+        (MediaPlayerPrivate):
+
 2012-05-31  Andy Estes  <aestes@apple.com>
 
         Disentangle code that relies on USE(AUTOMATIC_TEXT_REPLACEMENT) from that which merely relies on PLATFORM(MAC)
index 0af609f..c4c6ba4 100644 (file)
@@ -210,6 +210,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
     , m_readyStateMaximum(HAVE_NOTHING)
     , m_volume(1.0f)
     , m_lastSeekTime(0)
+    , m_previousProgress(0)
     , m_previousProgressTime(numeric_limits<double>::max())
     , m_lastTimeUpdateEventWallTime(0)
     , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max())
@@ -1376,6 +1377,7 @@ void HTMLMediaElement::startProgressEventTimer()
         return;
 
     m_previousProgressTime = WTF::currentTime();
+    m_previousProgress = 0;
     // 350ms is not magic, it is in the spec!
     m_progressEventTimer.startRepeating(0.350);
 }
@@ -1582,7 +1584,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
 void HTMLMediaElement::changeNetworkStateFromLoadingToIdle()
 {
     m_progressEventTimer.stop();
-    if (hasMediaControls() && m_player->didLoadingProgress())
+    if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress)
         mediaControls()->bufferingProgressed();
 
     // Schedule one last progress event so we guarantee that at least one is fired
@@ -1835,21 +1837,25 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
     if (m_networkState != NETWORK_LOADING)
         return;
 
+    unsigned progress = m_player->bytesLoaded();
     double time = WTF::currentTime();
     double timedelta = time - m_previousProgressTime;
 
-    if (m_player->didLoadingProgress()) {
+    if (progress == m_previousProgress) {
+        if (timedelta > 3.0 && !m_sentStalledEvent) {
+            scheduleEvent(eventNames().stalledEvent);
+            m_sentStalledEvent = true;
+            setShouldDelayLoadEvent(false);
+        }
+    } else {
         scheduleEvent(eventNames().progressEvent);
+        m_previousProgress = progress;
         m_previousProgressTime = time;
         m_sentStalledEvent = false;
         if (renderer())
             renderer()->updateFromElement();
         if (hasMediaControls())
             mediaControls()->bufferingProgressed();
-    } else if (timedelta > 3.0 && !m_sentStalledEvent) {
-        scheduleEvent(eventNames().stalledEvent);
-        m_sentStalledEvent = true;
-        setShouldDelayLoadEvent(false);
     }
 }
 
@@ -2717,6 +2723,7 @@ void HTMLMediaElement::startPlaybackProgressTimer()
         return;
 
     m_previousProgressTime = WTF::currentTime();
+    m_previousProgress = 0;
     m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency);
 }
 
index 9357330..af30eb1 100644 (file)
@@ -131,7 +131,7 @@ public:
     virtual PassRefPtr<TimeRanges> buffered() const { return TimeRanges::create(); }
 
     virtual unsigned totalBytes() const { return 0; }
-    virtual bool didLoadingProgress() const { return false; }
+    virtual unsigned bytesLoaded() const { return 0; }
 
     virtual void setSize(const IntSize&) { }
 
@@ -681,9 +681,9 @@ float MediaPlayer::maxTimeSeekable()
     return m_private->maxTimeSeekable();
 }
 
-bool MediaPlayer::didLoadingProgress()
+unsigned MediaPlayer::bytesLoaded()
 {
-    return m_private->didLoadingProgress();
+    return m_private->bytesLoaded();
 }
 
 void MediaPlayer::setSize(const IntSize& size)
index 516f2fe..a03ade7 100644 (file)
@@ -278,7 +278,7 @@ public:
     PassRefPtr<TimeRanges> seekable();
     float maxTimeSeekable();
 
-    bool didLoadingProgress();
+    unsigned bytesLoaded();
 
     float volume() const;
     void setVolume(float);
index 085278e..f76d49e 100644 (file)
@@ -96,7 +96,7 @@ public:
     virtual float maxTimeSeekable() const = 0;
     virtual PassRefPtr<TimeRanges> buffered() const = 0;
 
-    virtual bool didLoadingProgress() const = 0;
+    virtual unsigned bytesLoaded() const = 0;
 
     virtual void setSize(const IntSize&) = 0;
 
index 73134ed..8f3a8df 100644 (file)
@@ -57,7 +57,6 @@ MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation(MediaPlayer* play
     , m_cachedMaxTimeSeekable(0)
     , m_cachedDuration(invalidTime())
     , m_reportedDuration(invalidTime())
-    , m_maxTimeLoadedAtLastDidLoadingProgress(invalidTime())
     , m_seekTo(invalidTime())
     , m_requestedRate(1)
     , m_delayCallbacks(0)
@@ -367,15 +366,14 @@ float MediaPlayerPrivateAVFoundation::maxTimeLoaded() const
     return m_cachedMaxTimeLoaded;   
 }
 
-bool MediaPlayerPrivateAVFoundation::didLoadingProgress() const
+unsigned MediaPlayerPrivateAVFoundation::bytesLoaded() const
 {
-    if (!duration() || !totalBytes())
-        return false;
-    float currentMaxTimeLoaded = maxTimeLoaded();
-    bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress;
-    m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded;
-    LOG(Media, "MediaPlayerPrivateAVFoundation::didLoadingProgress(%p) - returning %d", this, didLoadingProgress);
-    return didLoadingProgress;
+    float dur = duration();
+    if (!dur)
+        return 0;
+    unsigned loaded = totalBytes() * maxTimeLoaded() / dur;
+    LOG(Media, "MediaPlayerPrivateAVFoundation::bytesLoaded(%p) - returning %i", this, loaded);
+    return loaded;
 }
 
 bool MediaPlayerPrivateAVFoundation::isReadyForVideoSetup() const
index 63fe6aa..7230234 100644 (file)
@@ -140,7 +140,7 @@ protected:
     virtual MediaPlayer::ReadyState readyState() const { return m_readyState; }
     virtual float maxTimeSeekable() const;
     virtual PassRefPtr<TimeRanges> buffered() const;
-    virtual bool didLoadingProgress() const;
+    virtual unsigned bytesLoaded() const;
     virtual void setSize(const IntSize&);
     virtual void paint(GraphicsContext*, const IntRect&) = 0;
     virtual void paintCurrentFrameInContext(GraphicsContext*, const IntRect&) = 0;
@@ -263,7 +263,7 @@ private:
     mutable float m_cachedMaxTimeSeekable;
     mutable float m_cachedDuration;
     float m_reportedDuration;
-    mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
+
     float m_seekTo;
     float m_requestedRate;
     mutable int m_delayCallbacks;
index 3ac93e8..aa78676 100644 (file)
@@ -288,10 +288,10 @@ PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const
     return timeRanges.release();
 }
 
-bool MediaPlayerPrivate::didLoadingProgress() const
+unsigned MediaPlayerPrivate::bytesLoaded() const
 {
     notImplemented();
-    return false;
+    return 0;
 }
 
 void MediaPlayerPrivate::setSize(const IntSize&)
index 0ac466b..36c36f8 100644 (file)
@@ -83,7 +83,7 @@ public:
     virtual float maxTimeSeekable() const;
     virtual PassRefPtr<TimeRanges> buffered() const;
 
-    virtual bool didLoadingProgress() const;
+    virtual unsigned bytesLoaded() const;
 
     virtual void setSize(const IntSize&);
 
index 839708e..5757a27 100644 (file)
@@ -227,7 +227,6 @@ MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
     , m_preload(MediaPlayer::Auto)
     , m_delayingLoad(false)
     , m_mediaDurationKnown(true)
-    , m_maxTimeLoadedAtLastDidLoadingProgress(0)
     , m_volumeTimerHandler(0)
     , m_muteTimerHandler(0)
     , m_hasVideo(false)
@@ -921,15 +920,17 @@ float MediaPlayerPrivateGStreamer::maxTimeLoaded() const
     return loaded;
 }
 
-bool MediaPlayerPrivateGStreamer::didLoadingProgress() const
+unsigned MediaPlayerPrivateGStreamer::bytesLoaded() const
 {
-    if (!m_playBin || !m_mediaDuration || !totalBytes())
-        return false;
-    float currentMaxTimeLoaded = maxTimeLoaded();
-    bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress;
-    m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded;
-    LOG_VERBOSE(Media, "didLoadingProgress: %d", didLoadingProgress);
-    return didLoadingProgress;
+    if (!m_playBin)
+        return 0;
+
+    if (!m_mediaDuration)
+        return 0;
+
+    unsigned loaded = totalBytes() * maxTimeLoaded() / m_mediaDuration;
+    LOG_VERBOSE(Media, "bytesLoaded: %d", loaded);
+    return loaded;
 }
 
 unsigned MediaPlayerPrivateGStreamer::totalBytes() const
index 39ee9ce..1b0ff26 100644 (file)
@@ -90,7 +90,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
 
             PassRefPtr<TimeRanges> buffered() const;
             float maxTimeSeekable() const;
-            bool didLoadingProgress() const;
+            unsigned bytesLoaded() const;
             unsigned totalBytes() const;
 
             void setVisible(bool);
@@ -181,7 +181,6 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
             MediaPlayer::Preload m_preload;
             bool m_delayingLoad;
             bool m_mediaDurationKnown;
-            mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
 #ifndef GST_API_VERSION_1
             RefPtr<GStreamerGWorld> m_gstGWorld;
 #endif
index 011ec36..3089ae2 100644 (file)
@@ -121,7 +121,7 @@ private:
     
     PassRefPtr<TimeRanges> buffered() const;
     float maxTimeSeekable() const;
-    bool didLoadingProgress() const;
+    unsigned bytesLoaded() const;
     unsigned totalBytes() const;
     
     void setVisible(bool);
@@ -212,7 +212,6 @@ private:
     bool m_videoFrameHasDrawn;
     bool m_isAllowedToRender;
     bool m_privateBrowsing;
-    mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
 #if DRAW_FRAME_RATE
     int  m_frameCountWhilePlaying;
     double m_timeStartedPlaying;
index 29249aa..98599e9 100644 (file)
@@ -214,7 +214,6 @@ MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit(MediaPlayer* player)
     , m_videoFrameHasDrawn(false)
     , m_isAllowedToRender(false)
     , m_privateBrowsing(false)
-    , m_maxTimeLoadedAtLastDidLoadingProgress(0)
 #if DRAW_FRAME_RATE
     , m_frameCountWhilePlaying(0)
     , m_timeStartedPlaying(0)
@@ -946,14 +945,12 @@ float MediaPlayerPrivateQTKit::maxTimeLoaded() const
     return wkQTMovieMaxTimeLoaded(m_qtMovie.get()); 
 }
 
-bool MediaPlayerPrivateQTKit::didLoadingProgress() const
+unsigned MediaPlayerPrivateQTKit::bytesLoaded() const
 {
-    if (!duration() || !totalBytes())
-        return false;
-    float currentMaxTimeLoaded = maxTimeLoaded();
-    bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress;
-    m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded;
-    return didLoadingProgress;
+    float dur = duration();
+    if (!dur)
+        return 0;
+    return totalBytes() * maxTimeLoaded() / dur;
 }
 
 unsigned MediaPlayerPrivateQTKit::totalBytes() const
index 3a307cb..9529cd4 100644 (file)
@@ -116,7 +116,6 @@ MediaPlayerPrivateQt::MediaPlayerPrivateQt(MediaPlayer* player)
     , m_isSeeking(false)
     , m_composited(false)
     , m_preload(MediaPlayer::Auto)
-    , m_bytesLoadedAtLastDidLoadingProgress(0)
     , m_suppressNextPlaybackChanged(false)
 {
     m_mediaPlayer->setVideoOutput(m_videoItem);
@@ -362,17 +361,13 @@ float MediaPlayerPrivateQt::maxTimeSeekable() const
     return static_cast<float>(m_mediaPlayerControl->availablePlaybackRanges().latestTime()) / 1000.0f;
 }
 
-bool MediaPlayerPrivateQt::didLoadingProgress() const
+unsigned MediaPlayerPrivateQt::bytesLoaded() const
 {
-    unsigned bytesLoaded = 0;
     QLatin1String bytesLoadedKey("bytes-loaded");
     if (m_mediaPlayer->availableExtendedMetaData().contains(bytesLoadedKey))
-        bytesLoaded = m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt();
-    else
-        bytesLoaded = m_mediaPlayer->bufferStatus();
-    bool didLoadingProgress = bytesLoaded != m_bytesLoadedAtLastDidLoadingProgress;
-    m_bytesLoadedAtLastDidLoadingProgress = bytesLoaded;
-    return didLoadingProgress;
+        return m_mediaPlayer->extendedMetaData(bytesLoadedKey).toInt();
+
+    return m_mediaPlayer->bufferStatus();
 }
 
 unsigned MediaPlayerPrivateQt::totalBytes() const
index c6fcbd8..67f64c7 100644 (file)
@@ -86,7 +86,7 @@ public:
 
     PassRefPtr<TimeRanges> buffered() const;
     float maxTimeSeekable() const;
-    bool didLoadingProgress() const;
+    unsigned bytesLoaded() const;
     unsigned totalBytes() const;
 
     void setVisible(bool);
@@ -156,7 +156,6 @@ private:
     bool m_isSeeking;
     bool m_composited;
     MediaPlayer::Preload m_preload;
-    mutable unsigned m_bytesLoadedAtLastDidLoadingProgress;
     bool m_delayingLoad;
     String m_mediaUrl;
     bool m_suppressNextPlaybackChanged;
index 7d9dcaf..b0037c3 100644 (file)
@@ -183,7 +183,6 @@ MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualConte
     , m_delayingLoad(false)
     , m_privateBrowsing(false)
     , m_preload(MediaPlayer::Auto)
-    , m_maxTimeLoadedAtLastDidLoadingProgress(0)
 {
 }
 
@@ -584,14 +583,15 @@ float MediaPlayerPrivateQuickTimeVisualContext::maxTimeLoaded() const
     return m_movie->maxTimeLoaded(); 
 }
 
-bool MediaPlayerPrivateQuickTimeVisualContext::didLoadingProgress() const
+unsigned MediaPlayerPrivateQuickTimeVisualContext::bytesLoaded() const
 {
-    if (!m_movie || !duration())
-        return false;
-    float currentMaxTimeLoaded = maxTimeLoaded();
-    bool didLoadingProgress = currentMaxTimeLoaded != m_maxTimeLoadedAtLastDidLoadingProgress;
-    m_maxTimeLoadedAtLastDidLoadingProgress = currentMaxTimeLoaded;
-    return didLoadingProgress;
+    if (!m_movie)
+        return 0;
+    float dur = duration();
+    float maxTime = maxTimeLoaded();
+    if (!dur)
+        return 0;
+    return totalBytes() * maxTime / dur;
 }
 
 unsigned MediaPlayerPrivateQuickTimeVisualContext::totalBytes() const
index 4c44af4..70fd2a5 100644 (file)
@@ -99,7 +99,7 @@ private:
     
     PassRefPtr<TimeRanges> buffered() const;
     float maxTimeSeekable() const;
-    bool didLoadingProgress() const;
+    unsigned bytesLoaded() const;
     unsigned totalBytes() const;
     
     void setVisible(bool);
@@ -201,7 +201,6 @@ private:
     String m_movieURL;
     bool m_privateBrowsing;
     MediaPlayer::Preload m_preload;
-    mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
 #if DRAW_FRAME_RATE
     double m_frameCountWhilePlaying;
     double m_timeStartedPlaying;
index 0faa045..8629373 100644 (file)
@@ -70,7 +70,6 @@ namespace WebCore {
 
         PassRefPtr<TimeRanges> buffered() const;
         float maxTimeSeekable() const;
-        // FIXME: bytesLoaded() should be replaced with didLoadingProgress() (by somebody who can find the implementation of this class).
         unsigned bytesLoaded() const;
         unsigned totalBytes() const;
 
index 6ba056a..a43510e 100644 (file)
@@ -1,3 +1,19 @@
+2012-05-31  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r119125.
+        http://trac.webkit.org/changeset/119125
+        https://bugs.webkit.org/show_bug.cgi?id=88007
+
+        Will break android build if rolled (Requested by rafaelw_ on
+        #webkit).
+
+        * public/WebMediaPlayer.h:
+        (WebMediaPlayer):
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::bytesLoaded):
+        * src/WebMediaPlayerClientImpl.h:
+        (WebMediaPlayerClientImpl):
+
 2012-05-31  Dana Jansens  <danakj@chromium.org>
 
         [chromium] Move drawing code for RenderSurfaces into LayerRendererChromium
index 444a2cc..3312f5f 100644 (file)
@@ -144,7 +144,7 @@ public:
     virtual NetworkState networkState() const = 0;
     virtual ReadyState readyState() const = 0;
 
-    virtual bool didLoadingProgress() const = 0;
+    virtual unsigned long long bytesLoaded() const = 0;
     virtual unsigned long long totalBytes() const = 0;
 
     virtual bool hasSingleSecurityOrigin() const = 0;
index 44e51cd..2411d9c 100644 (file)
@@ -593,9 +593,11 @@ unsigned WebMediaPlayerClientImpl::totalBytes() const
     return 0;
 }
 
-bool WebMediaPlayerClientImpl::didLoadingProgress() const
+unsigned WebMediaPlayerClientImpl::bytesLoaded() const
 {
-    return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress();
+    if (m_webMediaPlayer)
+        return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded());
+    return 0;
 }
 
 void WebMediaPlayerClientImpl::setSize(const IntSize& size)
index 0888d5e..72170f7 100644 (file)
@@ -122,7 +122,7 @@ public:
     virtual int dataRate() const;
     virtual bool totalBytesKnown() const;
     virtual unsigned totalBytes() const;
-    virtual bool didLoadingProgress() const;
+    virtual unsigned bytesLoaded() const;
     virtual void setSize(const WebCore::IntSize&);
     virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&);
     virtual void paintCurrentFrameInContext(WebCore::GraphicsContext*, const WebCore::IntRect&);