diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index 88e3f7841e..d9a6866f7c 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -378,7 +378,7 @@ struct vdec_context final while (!Emu.IsStopped() && out_max && (std::lock_guard{mutex}, out.size() > out_max)) { - in_cv.wait(cv_lock, 1000); + thread_ctrl::wait_for(1000); } } else if (auto* frc = std::get_if(&*cmds)) @@ -487,6 +487,12 @@ s32 cellVdecClose(ppu_thread& ppu, u32 handle) vdec->out_max = 0; vdec->in_cmd.push(vdec_close); vdec->in_cv.notify(); + + while (!atomic_storage::load(vdec->ppu_tid)) + { + thread_ctrl::wait_for(1000); + } + ppu_execute<&sys_interrupt_thread_disestablish>(ppu, vdec->ppu_tid); return CELL_OK; } @@ -574,7 +580,10 @@ s32 cellVdecGetPicture(u32 handle, vm::cptr format, vm::ptrin_cv.notify(); + { + auto vdec_ppu = idm::get>(vdec->ppu_tid); + thread_ctrl::notify(*vdec_ppu); + } if (outBuff) {