[mythtv] [PATCH] Workaround for hangs when ffwd/rewinding video

Matt Holgate matt-bulk-mythtv at holgate.org.uk
Tue Sep 26 18:52:45 UTC 2006

Paul Andreassen wrote:

> I've just noticed that I can no longer pause and move frame by frame.

I can't reproduce this myself - frame advance/rewind seem to work fine 
for me.

Does this happen every time? Is there anything useful in the 
mythfrontend log? Were you literally pressing pause then using the fast 
forward/rewind buttons? And are you running 0.20-fixes (I'm not running 
the *very* latest 0.20-fixes, rather one checked out soon after the 

I noticed that there are potentially other race conditions with calls to 
PauseVideo()/UnpauseVideo() - both the StartPlaying() thread and the 
input thread can call these functions, potentially interfering with each 
other. This is especially problematic when we end up in an infinite loop 
(like the case which my patch works around).

My fix was a workaround for one manifestation of this race, but there 
are potentially others (for example, if the user quickly pauses the 
video while the ffwd code is trying to unpause it, we end up in another 
infinite loop):

                     while (GetVideoPause())

I wonder if we need some extra synchronisation here? I don't know the 
code well enough to comment, but perhaps a reference count and lock on 
the video pause/unpause would help?

thanks in advance for any help with this,

More information about the mythtv-dev mailing list