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);