diff --git a/mythtv/libs/libmythtv/dvdringbuffer.cpp b/mythtv/libs/libmythtv/dvdringbuffer.cpp index 617fac4ca40..4025e7c88e2 100644 --- a/mythtv/libs/libmythtv/dvdringbuffer.cpp +++ b/mythtv/libs/libmythtv/dvdringbuffer.cpp @@ -502,7 +502,12 @@ void DVDRingBuffer::WaitForPlayer(void) m_playerWait = true; int count = 0; while (m_playerWait && count++ < 200) + { + rwlock.unlock(); usleep(10000); + rwlock.lockForWrite(); + } + if (m_playerWait) { VERBOSE(VB_IMPORTANT, LOC_ERR + @@ -530,6 +535,9 @@ int DVDRingBuffer::safe_read(void *data, uint sz) return -1; } + if (readaheadrunning) + VERBOSE(VB_IMPORTANT, LOC_ERR + "read ahead thread running."); + while (needed) { blockBuf = m_dvdBlockWriteBuf; @@ -886,7 +894,9 @@ int DVDRingBuffer::safe_read(void *data, uint sz) // pause a little as the dvdnav VM will continue to return // this event until it has been skipped + rwlock.unlock(); usleep(10000); + rwlock.lockForWrite(); // when scanning the file or exiting playback, skip immediately // otherwise update the timeout in the player @@ -919,7 +929,9 @@ int DVDRingBuffer::safe_read(void *data, uint sz) else { m_dvdWaiting = true; + rwlock.unlock(); usleep(10000); + rwlock.lockForWrite(); } // release buffer