Rearrange ThreadedFrameSource::Entry to allow the use of wxMutexLocker

Originally committed to SVN as r4788.
This commit is contained in:
Thomas Goyne 2010-09-15 22:10:42 +00:00
parent d3fca38ee7
commit dca2bd43fe
1 changed files with 19 additions and 15 deletions

View File

@ -115,22 +115,26 @@ AegiVideoFrame const& ThreadedFrameSource::ProcFrame(int frameNum, double time,
void *ThreadedFrameSource::Entry() { void *ThreadedFrameSource::Entry() {
while (!TestDestroy() && run) { while (!TestDestroy() && run) {
jobMutex.Lock(); double time;
if (nextSubs.get()) { int frameNum;
wxMutexLocker locker(fileMutex); {
subs = nextSubs; wxMutexLocker jobLocker(jobMutex);
singleFrame = -1;
}
if (nextTime == -1.) {
jobReady.Wait();
jobMutex.Unlock();
continue;
}
double time = nextTime; if (nextTime == -1.) {
int frameNum = nextFrame; jobReady.Wait();
nextTime = -1.; continue;
jobMutex.Unlock(); }
if (nextSubs.get()) {
wxMutexLocker fileLocker(fileMutex);
subs = nextSubs;
singleFrame = -1;
}
time = nextTime;
frameNum = nextFrame;
nextTime = -1.;
}
try { try {
AegiVideoFrame const& frame = ProcFrame(frameNum, time); AegiVideoFrame const& frame = ProcFrame(frameNum, time);