Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-10-28 Eric Carlson <eric.carlson@apple.com>
Reviewed by Adam Roben. Seeking by very small increment doesn't generate 'seeked' event https://bugs.webkit.org/show_bug.cgi?id=48530 Test: media/video-seek-by-small-increment.html * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::seek): Ask the media engine for its closest time value so we can avoid asking it to seek to the current time. * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::mediaTimeForTimeValue): New. * platform/graphics/MediaPlayer.h: * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::mediaTimeForTimeValue): Ditto. * platform/graphics/mac/MediaPlayerPrivateQTKit.h: * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: (WebCore::MediaPlayerPrivate::mediaTimeForTimeValue): Return the closest value in the movie's time scale. * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: (WebCore::MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue): Ditto * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h: * platform/graphics/win/QTMovie.cpp: (QTMovie::timeScale): Return the movie's time scale. * platform/graphics/win/QTMovie.h: 2010-10-28 Eric Carlson <eric.carlson@apple.com> Reviewed by Adam Roben. Seeking by very small increment doesn't generate 'seeked' event https://bugs.webkit.org/show_bug.cgi?id=48530 * media/video-seek-by-small-increment-expected.txt: Added. * media/video-seek-by-small-increment.html: Added. Canonical link: https://commits.webkit.org/61326@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
4c72212
commit feba1f50b8069b73f3a2ed7dc005faf2752b2340
Showing
14 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,36 @@ | ||
Test seeking by very small increments. | ||
|
||
EVENT(canplaythrough) | ||
EXPECTED (seekedEventCount == '0') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '1') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '2') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '3') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '4') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '5') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '6') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '7') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '8') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '9') OK | ||
EVENT(seeking) | ||
EVENT(seeked) | ||
EXPECTED (seekedEventCount == '10') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,65 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<script src=media-file.js></script> | ||
<script src=video-test.js></script> | ||
|
||
<script> | ||
var seekedEventCount = 0; | ||
var seeksAttempted = 0; | ||
var increment = 0.0004; | ||
|
||
function seekIncrement() | ||
{ | ||
// We want to verify that seeking by an increment smaller than the test movie's time scale | ||
// succeeds. test.mp4 has a time scale of 2500 (the smallest unit of time in that file | ||
// is 0.0004 seconds), so start with that and decrease by half each time. | ||
increment /= 2; | ||
return increment; | ||
} | ||
|
||
function seeked() | ||
{ | ||
++seekedEventCount; | ||
} | ||
|
||
function attemptSeek() | ||
{ | ||
var now = video.currentTime; | ||
|
||
video.currentTime = now + seekIncrement(); | ||
++seeksAttempted; | ||
setTimeout(testAgain, 10); | ||
} | ||
|
||
function testAgain() | ||
{ | ||
reportExpected(seeksAttempted == seekedEventCount, "seekedEventCount", "==", seeksAttempted, seekedEventCount); | ||
|
||
if (seeksAttempted == 10) { | ||
endTest(); | ||
return; | ||
} | ||
|
||
setTimeout(attemptSeek, 100); | ||
} | ||
|
||
function start() | ||
{ | ||
findMediaElement(); | ||
video.src = findMediaFile("video", "content/test"); | ||
|
||
waitForEvent('canplaythrough', testAgain); | ||
waitForEvent('seeked', seeked); | ||
waitForEvent('seeking'); | ||
waitForEvent('play'); | ||
waitForEvent('pause'); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<video controls></video> | ||
<p>Test seeking by very small increments.</p> | ||
<script>start()</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -274,6 +274,8 @@ class MediaPlayer : public Noncopyable { | ||
|
||
bool hasSingleSecurityOrigin() const; | ||
|
||
float mediaTimeForTimeValue(float) const; | ||
|
||
private: | ||
MediaPlayer(MediaPlayerClient*); | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -115,6 +115,8 @@ class QTMOVIEWIN_API QTMovie : public RefCounted<QTMovie> { | ||
|
||
Movie getMovieHandle() const; | ||
|
||
long timeScale() const; | ||
|
||
private: | ||
QTMoviePrivate* m_private; | ||
friend class QTMoviePrivate; | ||