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.