From 8652b7d358fe975242dd2c51c91fd2968e6bcb82 Mon Sep 17 00:00:00 2001 From: Elad Ashkenazi Date: Sun, 5 Feb 2023 14:02:51 +0200 Subject: [PATCH] cellVdec: Fix AU decode count on callback (#13342) --- rpcs3/Emu/Cell/Modules/cellVdec.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index e9ca207bcf..cddc8680da 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -205,7 +205,7 @@ struct vdec_context final std::deque out_queue; const u32 out_max = 60; - atomic_t au_count{0}; + atomic_t au_count{0}; lf_queue in_cmd; @@ -540,14 +540,11 @@ struct vdec_context final { // Send AUDONE even if the current sequence was reset and a new sequence was started. cellVdec.trace("Sending CELL_VDEC_MSG_TYPE_AUDONE (handle=0x%x, seq_id=%d, cmd_id=%d)", handle, cmd->seq_id, cmd->id); + ensure(au_count.try_dec(0)); + cb_func(ppu, vid, CELL_VDEC_MSG_TYPE_AUDONE, CELL_OK, cb_arg); lv2_obj::sleep(ppu); - if (au_count > 0) - { - --au_count; - } - while (!decoded_frames.empty() && seq_id == cmd->seq_id) { // Wait until there is free space in the image queue.