Merge pull request #893 from merwie/fix/avplayer-frame-at-jump-while-paused

fix(avplayer): deliver the frame at a jump while paused
This commit is contained in:
Dean
2026-10-07 10:17:07 +13:00
committed by GitHub
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ int Player::SetAvSyncMode(std::uint32_t mode) {
bool Player::GetVideoData(AvPlayerFrameInfoEx& info) {
std::lock_guard lock(mutex);
if (!source || state != State::Play) return false;
if (!source || (state != State::Play && state != State::Pause)) return false;
return source->GetVideoData(info);
}
+2 -1
View File
@@ -494,7 +494,7 @@ private:
}
bool takeVideo(AvPlayerFrameInfoEx& info) {
if (!started || paused || video.stream < 0 || speed < 0) return false;
if (!started || video.stream < 0 || speed < 0) return false;
if (speed != NormalSpeed) dropLateAudio();
auto& frames = video.frames;
const bool synced = syncMode == SyncModeDefault;
@@ -502,6 +502,7 @@ private:
while (!frames.empty() && frames.front().epoch < stale) recycleFront(video);
if (frames.empty()) return false;
const auto& front = frames.front();
if (paused && front.epoch <= clockEpoch) return false;
if (front.epoch > clockEpoch) {
if (synced && audioDriving && speed == NormalSpeed) return false;
if (synced && front.seamless && presented && presentationClock.Now() < static_cast<double>(lastPresented + frameDuration())) return false;
+7
View File
@@ -756,6 +756,13 @@ void TestPlayback() {
Check(!sceAvPlayerGetVideoDataEx(player, &frame) && !sceAvPlayerGetAudioData(player, &sound), "data delivered while paused");
Check(sceAvPlayerCurrentTime(player) == paused, "clock moved while paused");
Check(sceAvPlayerIsActive(player), "inactive while paused");
Check(sceAvPlayerJumpToTime(player, 300) == 0, "jump while paused failed");
Check(WaitFor([&] { return events.Seen(EventWarning, JumpComplete); }), "jump completion missing while paused");
Check(WaitFor([&] { return sceAvPlayerGetVideoDataEx(player, &frame) != 0; }), "no frame at a jump while paused");
CheckVideoFrame(frame);
Check(frame.timestamp >= 300 && frame.timestamp <= 367, "paused jump landed at " + std::to_string(frame.timestamp));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Check(!sceAvPlayerGetVideoDataEx(player, &frame) && !sceAvPlayerGetAudioData(player, &sound), "data delivered after the frame at a paused jump");
events.Clear();
Check(sceAvPlayerResume(player) == 0, "resume failed");
Check(sceAvPlayerResume(player) == OperationFailed, "resume accepted while playing");