mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
Video freezing fixed
This commit is contained in:
parent
4a6ef91eb3
commit
cf335a5dc4
2 changed files with 32 additions and 11 deletions
|
@ -347,12 +347,18 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
|
|||
if (!stream.peek(code))
|
||||
{
|
||||
// demuxing finished
|
||||
dmux.is_running = false;
|
||||
|
||||
// callback
|
||||
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
||||
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
||||
dmuxMsg->supplementalInfo = stream.userdata;
|
||||
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
||||
|
||||
dmux.is_running = false;
|
||||
dmux.is_working = false;
|
||||
|
||||
stream = {};
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -634,16 +640,20 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
|
|||
case dmuxResetStream:
|
||||
case dmuxResetStreamAndWaitDone:
|
||||
{
|
||||
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
||||
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
||||
dmuxMsg->supplementalInfo = stream.userdata;
|
||||
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
||||
// demuxing stopped
|
||||
if (dmux.is_running.exchange(false))
|
||||
{
|
||||
// callback
|
||||
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
||||
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
||||
dmuxMsg->supplementalInfo = stream.userdata;
|
||||
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
||||
|
||||
stream = {};
|
||||
|
||||
dmux.is_working = false;
|
||||
}
|
||||
|
||||
stream = {};
|
||||
dmux.is_running = false;
|
||||
//if (task.type == dmuxResetStreamAndWaitDone)
|
||||
//{
|
||||
//}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -926,8 +936,16 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
|
|||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!dmux->is_running)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
dmux->is_working = true;
|
||||
|
||||
dmux->job.push(DemuxerTask(dmuxResetStreamAndWaitDone), &dmux->is_closed);
|
||||
while (dmux->is_running && !dmux->is_closed) // TODO: ensure that it is safe
|
||||
|
||||
while (dmux->is_running && dmux->is_working && !dmux->is_closed) // TODO: ensure that it is safe
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
|
@ -936,6 +954,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
|
|||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -404,6 +404,7 @@ public:
|
|||
volatile bool is_finished;
|
||||
volatile bool is_closed;
|
||||
std::atomic<bool> is_running;
|
||||
std::atomic<bool> is_working;
|
||||
|
||||
PPUThread* dmuxCb;
|
||||
|
||||
|
@ -411,6 +412,7 @@ public:
|
|||
: is_finished(false)
|
||||
, is_closed(false)
|
||||
, is_running(false)
|
||||
, is_working(false)
|
||||
, memAddr(addr)
|
||||
, memSize(size)
|
||||
, cbFunc(func)
|
||||
|
|
Loading…
Add table
Reference in a new issue