2009-09-18 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Darin Adler.

        NULL check HTMLMediaElement::m_playedTimeRanges.
        Fix for https://bugs.webkit.org/show_bug.cgi?id=29494

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::addPlayedRange): New. Create m_playedTimeRanges if
        necessary, add range specified.
        (WebCore::HTMLMediaElement::seek): Use addPlayedRange. 
        (WebCore::HTMLMediaElement::played): Use addPlayedRange. Change time comparison 
        to be more readable.
        (WebCore::HTMLMediaElement::updatePlayState): Ditto.
        * html/HTMLMediaElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48519 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 22471b2e
2009-09-18 Eric Carlson <eric.carlson@apple.com>
Reviewed by Darin Adler.
NULL check HTMLMediaElement::m_playedTimeRanges.
Fix for https://bugs.webkit.org/show_bug.cgi?id=29494
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addPlayedRange): New. Create m_playedTimeRanges if
necessary, add range specified.
(WebCore::HTMLMediaElement::seek): Use addPlayedRange.
(WebCore::HTMLMediaElement::played): Use addPlayedRange. Change time comparison
to be more readable.
(WebCore::HTMLMediaElement::updatePlayState): Ditto.
* html/HTMLMediaElement.h:
2009-09-18 Sam Weinig <sam@webkit.org>
Reviewed by Adele Peterson.
......@@ -896,6 +896,13 @@ void HTMLMediaElement::returnToRealtime()
setCurrentTime(maxTimeSeekable(), e);
}
void HTMLMediaElement::addPlayedRange(float start, float end)
{
if (!m_playedTimeRanges)
m_playedTimeRanges = TimeRanges::create();
m_playedTimeRanges->add(start, end);
}
bool HTMLMediaElement::supportsSave() const
{
return m_player ? m_player->supportsSave() : false;
......@@ -931,7 +938,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
// 5
if (m_playing) {
if (m_lastSeekTime < now)
m_playedTimeRanges->add(m_lastSeekTime, now);
addPlayedRange(m_lastSeekTime, now);
}
m_lastSeekTime = time;
......@@ -1483,17 +1490,17 @@ PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
return m_player->buffered();
}
PassRefPtr<TimeRanges> HTMLMediaElement::played() const
PassRefPtr<TimeRanges> HTMLMediaElement::played()
{
if (!m_playedTimeRanges) {
// We are not yet loaded
return TimeRanges::create();
}
if (m_playing) {
float time = currentTime();
if (m_lastSeekTime < time)
m_playedTimeRanges->add(m_lastSeekTime, time);
if (time > m_lastSeekTime)
addPlayedRange(m_lastSeekTime, time);
}
if (!m_playedTimeRanges)
m_playedTimeRanges = TimeRanges::create();
return m_playedTimeRanges->copy();
}
......@@ -1589,8 +1596,8 @@ void HTMLMediaElement::updatePlayState()
m_playbackProgressTimer.stop();
m_playing = false;
float time = currentTime();
if (m_lastSeekTime < time)
m_playedTimeRanges->add(m_lastSeekTime, time);
if (time > m_lastSeekTime)
addPlayedRange(m_lastSeekTime, time);
}
if (renderer())
......
......@@ -120,7 +120,7 @@ public:
void setPlaybackRate(float);
bool webkitPreservesPitch() const;
void setWebkitPreservesPitch(bool);
PassRefPtr<TimeRanges> played() const;
PassRefPtr<TimeRanges> played();
PassRefPtr<TimeRanges> seekable() const;
bool ended() const;
bool autoplay() const;
......@@ -193,6 +193,7 @@ private:
void seek(float time, ExceptionCode&);
void finishSeek();
void checkIfSeekNeeded();
void addPlayedRange(float start, float end);
void scheduleTimeupdateEvent(bool periodicEvent);
void scheduleProgressEvent(const AtomicString& eventName);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment