[mythtv] mythtv blocking/crashing fix

Daniel Thor Kristjansson danielk at cat.nyu.edu
Fri Jan 30 15:09:50 EST 2004


Sure, see attached.

-- Daniel
  << When truth is outlawed; only outlaws will tell the truth. >> - RLiegh

On Fri, 30 Jan 2004, Isaac Richards wrote:

]On Friday 30 January 2004 12:54 am, Daniel Thor Kristjansson wrote:
]> The frontend is blocking forever when I tune into an off-air hdtv
]> channel. This patch exits mythtv after about 20 seconds of no input and
]> returns to mythtvfrontend.
]>
]> I also have a fix that makes the httv backend a little more robust but
]> I'm still looking at how to tune it.
]>
]> Please try this if you have a hdtv card, or you've had this problem
]> with another capture card.
]>
]> Also, if someone familiar with the RingBuffer and tv_play has some time,
]> I'd like it if you look at this, this my first attempt hacking Myth and
]> I may have missed something.
]
]Mind resending it as a unified diff (diff -u)?
]
]Isaac
]_______________________________________________
]mythtv-dev mailing list
]mythtv-dev at mythtv.org
]http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
]
-------------- next part --------------
--- mythtv/libs/libmythtv/RingBuffer.cpp	2004-01-28 00:04:37.000000000 -0500
+++ mythtv-new/libs/libmythtv/RingBuffer.cpp	2004-01-30 00:21:07.000000000 -0500
@@ -812,13 +812,23 @@
 
     int avail = ReadBufAvail();
 
+    int readErr=0;
     while (avail < count && !stopreads)
     {
         availWaitMutex.lock();
         wanttoread = count;
-        if (!availWait.wait(&availWaitMutex, 2000))
+        if (!availWait.wait(&availWaitMutex, 2000)) {
             cerr << "Waited 2 seconds for data to become available, waiting "
                     "again...\n";
+	    readErr++;
+	    if (readErr>5) {
+	      cerr << "Waited 10 seconds for data to become available, aborting" << endl;
+	      wanttoread=0;
+	      stopreads=true;
+	      availWaitMutex.unlock();
+	      return 0;
+	    }
+	}
         wanttoread = 0;
         availWaitMutex.unlock();
 
--- mythtv/libs/libmythtv/tv_play.cpp	2004-01-28 15:23:17.000000000 -0500
+++ mythtv-new/libs/libmythtv/tv_play.cpp	2004-01-30 00:25:19.000000000 -0500
@@ -603,6 +603,15 @@
     {
         VERBOSE(VB_GENERAL, QString("Changing from %1 to %2")
                 .arg(origname).arg(statename));
+        if (!activenvp->IsDecoderThreadAlive() && kState_None!=nextState) {
+            cerr<<"panic: decoder not alive and state not None"<<endl;
+            if (kState_WatchingLiveTV==nextState) {
+                cerr<<"stopping recorder"<<endl;
+                StopPlayerAndRecorder(false, true);
+                recorder=false;
+            }
+            tmpInternalState=kState_None;
+        }
     }
 
     internalState = tmpInternalState;


More information about the mythtv-dev mailing list