Core: Fix possible video sync deadlock

This commit is contained in:
Vicki Pfau 2020-11-27 17:38:31 -08:00
parent 39324749f2
commit bb74b60cd9
1 changed files with 2 additions and 1 deletions

View File

@ -49,11 +49,11 @@ bool mCoreSyncWaitFrameStart(struct mCoreSync* sync) {
} }
MutexLock(&sync->videoFrameMutex); MutexLock(&sync->videoFrameMutex);
ConditionWake(&sync->videoFrameRequiredCond);
if (!sync->videoFrameWait && !sync->videoFramePending) { if (!sync->videoFrameWait && !sync->videoFramePending) {
return false; return false;
} }
if (sync->videoFrameWait) { if (sync->videoFrameWait) {
ConditionWake(&sync->videoFrameRequiredCond);
if (ConditionWaitTimed(&sync->videoFrameAvailableCond, &sync->videoFrameMutex, 50)) { if (ConditionWaitTimed(&sync->videoFrameAvailableCond, &sync->videoFrameMutex, 50)) {
return false; return false;
} }
@ -67,6 +67,7 @@ void mCoreSyncWaitFrameEnd(struct mCoreSync* sync) {
return; return;
} }
ConditionWake(&sync->videoFrameRequiredCond);
MutexUnlock(&sync->videoFrameMutex); MutexUnlock(&sync->videoFrameMutex);
} }