Make ThreadedFrameSource never lock jobMutex and fileMutex at the same time. Moderately improves responsiveness of the audio display while video is loaded.

Originally committed to SVN as r5070.
This commit is contained in:
Thomas Goyne 2010-12-30 22:19:36 +00:00
parent ca8b6d8525
commit 5370f3fa04
2 changed files with 10 additions and 8 deletions

View file

@ -125,6 +125,7 @@ void *ThreadedFrameSource::Entry() {
while (!TestDestroy() && run) {
double time;
int frameNum;
std::auto_ptr<AssFile> newSubs;
{
wxMutexLocker jobLocker(jobMutex);
@ -133,15 +134,16 @@ void *ThreadedFrameSource::Entry() {
continue;
}
if (nextSubs.get()) {
wxMutexLocker fileLocker(fileMutex);
subs = nextSubs;
singleFrame = -1;
}
time = nextTime;
frameNum = nextFrame;
nextTime = -1.;
newSubs = nextSubs;
}
if (newSubs.get()) {
wxMutexLocker fileLocker(fileMutex);
subs = newSubs;
singleFrame = -1;
}
try {

View file

@ -69,8 +69,8 @@ class ThreadedFrameSource : public wxThread {
/// it was last sent to the subtitle provider
int singleFrame;
wxMutex fileMutex; ///< Mutex for subtitle file usage
wxMutex jobMutex; ///< Mutex for nextFrame/nextTime
wxMutex fileMutex; ///< Mutex for subs and singleFrame
wxMutex jobMutex; ///< Mutex for nextFrame, nextTime and nextSubs
wxMutex providerMutex; ///< Mutex for video provider
wxMutex evtMutex; ///< Mutex for FrameReadyEvents associated with this