id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,mlocked 8854,Locking problem in videobuffers WaitForAvailable(),tomi.orava@…,danielk,"The following code block is flawed by design in videobuffers.h: bool WaitForAvailable(uint w) { // Qt4 requires a QMutex as a parameter... // not sure if this is the best solution. Mutex Must be locked before wait. QMutex mutex; mutex.lock(); return available_wait.wait(&mutex, w); } The problem is of course that the mutex is completely bogus when defined inside the method. Also none of the calls to the available_wait.WakeAll() have the same mutex locked and therefore it is very easy to have a race condition between threads where the available_wait.WakeAll() signal is being missed by this method completely thus allowing the mythfrontend to hang completely with the following error message repeating itself over and over again: 010-09-02 21:06:52.733 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:06:54.763 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:06:56.800 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:06:58.824 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:07:00.848 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:07:02.870 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:07:04.894 Player(1): Timed out waiting for free video buffers. 2010-09-02 21:07:06.917 Player(1): Timed out waiting for free video buffers. A pretty easy way to reproduce this problem is to rewind quickly and then press enter to continue playback. If the rewinding is short enough the frontend has a high chance of hanging at least on all the machines I have here. The problematic code block (and problem) has existed for ages even in trunk and the current version I have is: r26022 ",defect,closed,minor,0.24,MythTV - General,Master Head,medium,Fixed,Timed out waiting for free video buffers.,,0