mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12: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))
|
if (!stream.peek(code))
|
||||||
{
|
{
|
||||||
// demuxing finished
|
// demuxing finished
|
||||||
|
dmux.is_running = false;
|
||||||
|
|
||||||
|
// callback
|
||||||
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
||||||
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
||||||
dmuxMsg->supplementalInfo = stream.userdata;
|
dmuxMsg->supplementalInfo = stream.userdata;
|
||||||
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
||||||
|
|
||||||
dmux.is_running = false;
|
dmux.is_working = false;
|
||||||
|
|
||||||
|
stream = {};
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,16 +640,20 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
|
||||||
case dmuxResetStream:
|
case dmuxResetStream:
|
||||||
case dmuxResetStreamAndWaitDone:
|
case dmuxResetStreamAndWaitDone:
|
||||||
{
|
{
|
||||||
|
// demuxing stopped
|
||||||
|
if (dmux.is_running.exchange(false))
|
||||||
|
{
|
||||||
|
// callback
|
||||||
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
auto dmuxMsg = vm::ptr<CellDmuxMsg>::make(dmux.memAddr + (cb_add ^= 16));
|
||||||
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
dmuxMsg->msgType = CELL_DMUX_MSG_TYPE_DEMUX_DONE;
|
||||||
dmuxMsg->supplementalInfo = stream.userdata;
|
dmuxMsg->supplementalInfo = stream.userdata;
|
||||||
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
dmux.cbFunc(*dmux.dmuxCb, dmux.id, dmuxMsg, dmux.cbArg);
|
||||||
|
|
||||||
stream = {};
|
stream = {};
|
||||||
dmux.is_running = false;
|
|
||||||
//if (task.type == dmuxResetStreamAndWaitDone)
|
dmux.is_working = false;
|
||||||
//{
|
}
|
||||||
//}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -926,8 +936,16 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
|
||||||
return CELL_DMUX_ERROR_ARG;
|
return CELL_DMUX_ERROR_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!dmux->is_running)
|
||||||
|
{
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
dmux->is_working = true;
|
||||||
|
|
||||||
dmux->job.push(DemuxerTask(dmuxResetStreamAndWaitDone), &dmux->is_closed);
|
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())
|
if (Emu.IsStopped())
|
||||||
{
|
{
|
||||||
|
@ -936,6 +954,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||||
}
|
}
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,6 +404,7 @@ public:
|
||||||
volatile bool is_finished;
|
volatile bool is_finished;
|
||||||
volatile bool is_closed;
|
volatile bool is_closed;
|
||||||
std::atomic<bool> is_running;
|
std::atomic<bool> is_running;
|
||||||
|
std::atomic<bool> is_working;
|
||||||
|
|
||||||
PPUThread* dmuxCb;
|
PPUThread* dmuxCb;
|
||||||
|
|
||||||
|
@ -411,6 +412,7 @@ public:
|
||||||
: is_finished(false)
|
: is_finished(false)
|
||||||
, is_closed(false)
|
, is_closed(false)
|
||||||
, is_running(false)
|
, is_running(false)
|
||||||
|
, is_working(false)
|
||||||
, memAddr(addr)
|
, memAddr(addr)
|
||||||
, memSize(size)
|
, memSize(size)
|
||||||
, cbFunc(func)
|
, cbFunc(func)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue