From b80311be9720a8ad3d4ad261ddabd13cfd105521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 16 Sep 2010 12:39:51 +0000 Subject: [PATCH] Only seek to keyframes when the difference in frames is more than 5 frames. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38669 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/Controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index c372c5fca4..ba0ed90521 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -722,15 +722,18 @@ Controller::SetFramePosition(int64 value) fRequestedSeekFrame = max_c(0, min_c(_FrameDuration(), value)); fSeekFrame = fRequestedSeekFrame; + int64 currentFrame = CurrentFrame(); + // Snap to a video keyframe, since that will be the fastest // to display and seeking will feel more snappy. Note that we // don't store this change in fSeekFrame, since we still want // to report the originally requested seek frame in TimePosition() // until we could reach that frame. - if (Duration() > 240 && fVideoTrackSupplier != NULL) + if (Duration() > 240 && fVideoTrackSupplier != NULL + && abs(value - currentFrame) > 5) { fVideoTrackSupplier->FindKeyFrameForFrame(&fSeekFrame); + } - int64 currentFrame = CurrentFrame(); //printf("SetFramePosition(%lld) -> %lld (current: %lld, duration: %lld) " //"(video: %p)\n", value, fSeekFrame, currentFrame, _FrameDuration(), //fVideoTrackSupplier);