From 2cc22e8a26afe0dc90d0da6b276cc46dcc308f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 1 Sep 2010 21:51:56 +0000 Subject: [PATCH] Don't try to decode more than 5 frames at a time to reach the seek frame. It's just not such a good strategy, since it appears to be faster to just wait until the next keyframe is reached naturally. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38506 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp b/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp index a813f56bfe..69f3b991bf 100644 --- a/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp +++ b/src/apps/mediaplayer/supplier/ProxyVideoSupplier.cpp @@ -42,6 +42,12 @@ ProxyVideoSupplier::FillBuffer(int64 startFrame, void* buffer, status_t ret = fSupplier->SeekToFrame(&frame); if (ret != B_OK) return ret; + // Read frames until we reach the frame before the one we want to read. + // But don't do it for more than 5 frames, or we will take too much + // time. Doing it this way will still catch up to the next keyframe + // eventually (we may return the wrong frames until the next keyframe). + if (startFrame - frame > 5) + return B_TIMED_OUT; while (frame < startFrame) { ret = fSupplier->ReadFrame(buffer, &performanceTime, format, wasCached);