[mythtv] Ticket 9201 - Why is Ticket locked? I've the same problem!

Jochen Kühner jochen.kuehner at gmx.de
Tue Dec 14 09:44:18 UTC 2010


I've tryed the patch, now the first start of LiveTv seems to work every
time, but after a channel change i still got  jump buffer errors all the
time!

Recording without LiveTV works fine!


-----Ursprüngliche Nachricht-----
Von: mythtv-dev-bounces at mythtv.org [mailto:mythtv-dev-bounces at mythtv.org] Im
Auftrag von Kevin Buhr
Gesendet: Montag, 13. Dezember 2010 18:04
An: Development of MythTV
Betreff: Re: [mythtv] Ticket 9201 - Why is Ticket locked? I've the same
problem!

Jochen Kühner <jochen.kuehner at gmx.de> writes:
>
> Why is the Ticket 9201 locked?
>
> Is no additional Information needed, I?ve the same problem!

Hi, Jochen,

You might want to try the attached patch. I'd be interested to know if it
fixes your problem (and maybe tickets 9177 and 9353 and others).

I was having numerous problems while switching channels, too, with jump
buffer errors, crashes, and so on. Eventually, I was able to reliably
duplicate it by switching between two particular channels to cause a crash,
and I found the following problem.

In mythplayer.cpp, it seems the player thread is allowed to keep running
during the SetDecoder() call. This is dangerous, both because the old
decoder is being torn down and the new decoder is not yet ready for prime
time. For example, ffmpeg can be destructing or still constructing context
information that the decoder thread is trying to read (result:
my duplicatible crash when an ffmpeg AVFormatContext->iformat pointer was
NULL).

I added a PauseDecoder() call at the beginning of SetDecoder(), and this
seemed to fix the crash problem without introducing any undesirable
behavior. I haven't seen a jump buffer error since, where I used to see them
fairly often. I also needed to remove the "&& !eof" in
PauseDecoder() to handle all cases. If there is an "eof" condition, the new
PauseDecoder() call in SetDecoder() *still* needs the decoder thread to
pause before it switches decoders, and I couldn't figure out why the "&&
!eof" check would be desirable in any other circumstances.

Anyway, the patch is attached. It's against a Mythbuntu autobuild
(0.24.0~trunk26882-0ubuntu0~mythbuntu2), which is what I've been testing for
a month or so. It appears to apply cleanly against the current Git HEAD, but
I haven't tested it.

diff -ru mythtv-0.24.0~trunk26882.vanilla/libs/libmythtv/mythplayer.cpp
mythtv-0.24.0~trunk26882/libs/libmythtv/mythplayer.cpp
--- mythtv-0.24.0~trunk26882.vanilla/libs/libmythtv/mythplayer.cpp
2010-10-18 18:12:40.000000000 -0500
+++ mythtv-0.24.0~trunk26882/libs/libmythtv/mythplayer.cpp	2010-11-06
16:36:02.000000000 -0500
@@ -2684,7 +2684,7 @@
 
     int tries = 0;
     pauseDecoder = true;
-    while (decoderThread && !killdecoder && !eof && (tries++ < 100) &&
+    while (decoderThread && !killdecoder && (tries++ < 100) &&
           !decoderThreadPause.wait(&decoderPauseLock, 100))
     {
         VERBOSE(VB_IMPORTANT, LOC_WARN + "Waited 100ms for decoder to
pause"); @@ -4439,11 +4439,14 @@
 
 /** \fn MythPlayer::SetDecoder(DecoderBase*)
  *  \brief Sets the stream decoder, deleting any existing recorder.
+ *
+ *    Note that this has the side effect of pausing the decoder thread.
  */
 void MythPlayer::SetDecoder(DecoderBase *dec)  {
     QMutexLocker locker(&decoder_change_lock);
 
+    PauseDecoder();
     if (!decoder)
         decoder = dec;
     else



_______________________________________________
mythtv-dev mailing list
mythtv-dev at mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev



More information about the mythtv-dev mailing list