Reviewed by Eric Carlson.
Frame accurate seeking isn't always accurate
https://bugs.webkit.org/show_bug.cgi?id=52697
New pixel test that seeks to specific currentTimes and records the rendered frame.
* media/content/test-25fps.mp4: Added.
* media/content/test-25fps.ogv: Added.
* media/video-frame-accurate-seek-expected.txt: Added.
* media/video-frame-accurate-seek.html: Added.
* platform/mac/media/video-frame-accurate-seek-expected.checksum: Added.
* platform/mac/media/video-frame-accurate-seek-expected.png: Added.
2011-02-04 Jer Noble <jer.noble@apple.com>
Reviewed by Eric Carlson.
Frame accurate seeking isn't always accurate
https://bugs.webkit.org/show_bug.cgi?id=52697
Test: media/video-frame-accurate-seek.html
Make seeking slightly more accurate by rounding instead of truncating
when converting from seconds-in-float to time/timeScale.
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::createQTTime):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue):
* platform/graphics/win/QTMovie.cpp:
(QTMovie::setCurrentTime):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77690
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-04 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Frame accurate seeking isn't always accurate
+ https://bugs.webkit.org/show_bug.cgi?id=52697
+
+ New pixel test that seeks to specific currentTimes and records the rendered frame.
+
+ * media/content/test-25fps.mp4: Added.
+ * media/content/test-25fps.ogv: Added.
+ * media/video-frame-accurate-seek-expected.txt: Added.
+ * media/video-frame-accurate-seek.html: Added.
+ * platform/mac/media/video-frame-accurate-seek-expected.checksum: Added.
+ * platform/mac/media/video-frame-accurate-seek-expected.png: Added.
+
2011-02-04 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Nate Chapin.
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x546
+ RenderBlock {HTML} at (0,0) size 800x546
+ RenderBody {BODY} at (8,16) size 784x522
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 715x18
+ text run at (0,0) width 715: "Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14."
+ RenderBlock (anonymous) at (0,34) size 784x488
+ RenderText {#text} at (320,226) size 4x18
+ text run at (320,226) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+ RenderText {#text} at (0,0) size 0x0
+layer at (8,50) size 320x240
+ RenderVideo {VIDEO} at (0,0) size 320x240
+layer at (332,50) size 320x240
+ RenderVideo {VIDEO} at (324,0) size 320x240
+layer at (8,294) size 320x240
+ RenderVideo {VIDEO} at (0,244) size 320x240
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="media-file.js"></script>
+ <script src="video-paint-test.js"></script>
+ </head>
+ <body onload="setSrcByTagName('video', findMediaFile('video', 'content/test-25fps')); init()">
+ <p>Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.</p>
+ <video oncanplaythrough='event.target.currentTime=(12/25)'></video>
+ <video oncanplaythrough='event.target.currentTime=(13/25)'></video>
+ <video oncanplaythrough='event.target.currentTime=(14.6/25)'></video>
+ </body>
+</html>
--- /dev/null
+d19012c97a2b645cba7ae1db65dc7249
\ No newline at end of file
+2011-02-04 Jer Noble <jer.noble@apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Frame accurate seeking isn't always accurate
+ https://bugs.webkit.org/show_bug.cgi?id=52697
+
+ Test: media/video-frame-accurate-seek.html
+
+ Make seeking slightly more accurate by rounding instead of truncating
+ when converting from seconds-in-float to time/timeScale.
+
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivateQTKit::createQTTime):
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::mediaTimeForTimeValue):
+ * platform/graphics/win/QTMovie.cpp:
+ (QTMovie::setCurrentTime):
+
2011-02-04 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Nate Chapin.
if (!metaDataAvailable())
return QTMakeTime(0, 600);
long timeScale = [[m_qtMovie.get() attributeForKey:QTMovieTimeScaleAttribute] longValue];
- return QTMakeTime(time * timeScale, timeScale);
+ return QTMakeTime(lroundf(time * timeScale), timeScale);
}
void MediaPlayerPrivateQTKit::resumeLoad()
if (m_readyState < MediaPlayer::HaveMetadata || !(timeScale = m_movie->timeScale()))
return timeValue;
- long mediaTimeValue = static_cast<long>(timeValue * timeScale);
+ long mediaTimeValue = lroundf(timeValue * timeScale);
return static_cast<float>(mediaTimeValue) / timeScale;
}
#include <QuickTimeComponents.h>
#include <WebKitSystemInterface/WebKitSystemInterface.h>
#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
m_private->m_seeking = true;
TimeScale scale = GetMovieTimeScale(m_private->m_movie);
if (m_private->m_movieController) {
- QTRestartAtTimeRecord restart = { time * scale , 0 };
+ QTRestartAtTimeRecord restart = { lroundf(time * scale) , 0 };
MCDoAction(m_private->m_movieController, mcActionRestartAtTime, (void *)&restart);
} else
- SetMovieTimeValue(m_private->m_movie, TimeValue(time * scale));
+ SetMovieTimeValue(m_private->m_movie, TimeValue(lroundf(time * scale)));
QTMovieTask::sharedTask()->updateTaskTimer();
}