[mythtv] [Patch] frontend abort livetv if backend conencted aborted
Mark Spieth
mark at dclabs.com.au
Mon Aug 16 19:39:23 EDT 2004
had a problem with the backend socket being shutdown and then the frontend
locked up spinning in a loop in nuppelvideoplayer. so attached is a
robustness patch to help the frontend recover if this happens to happen.
cheers
mark
-------------- next part --------------
Index: remoteencoder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteencoder.cpp,v
retrieving revision 1.25
diff -a -u -r1.25 remoteencoder.cpp
--- remoteencoder.cpp 15 Aug 2004 22:38:29 -0000 1.25
+++ remoteencoder.cpp 16 Aug 2004 23:27:47 -0000
@@ -15,6 +15,7 @@
recordernum = num;
remotehost = host;
remoteport = port;
+ backendError = false;
lastchannel = "";
@@ -53,10 +54,12 @@
pthread_mutex_lock(&lock);
+ backendError = false;
WriteStringList(controlSock, strlist);
if (!ReadStringList(controlSock, strlist, true))
{
cerr << "Remote encoder not responding.\n";
+ backendError = true;
}
pthread_mutex_unlock(&lock);
Index: remoteencoder.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/remoteencoder.h,v
retrieving revision 1.19
diff -a -u -r1.19 remoteencoder.h
--- remoteencoder.h 15 Aug 2004 22:38:29 -0000 1.19
+++ remoteencoder.h 16 Aug 2004 23:27:47 -0000
@@ -67,6 +67,8 @@
QString GetCurrentChannel(void);
+ bool GetErrorStatus(void) { bool v = backendError; backendError = false; return v; }
+
private:
QSocketDevice *openControlSocket(const QString &host, short port);
void SendReceiveStringList(QStringList &strlist);
@@ -80,6 +82,7 @@
short remoteport;
QString lastchannel;
+ bool backendError;
};
#endif
Index: NuppelVideoPlayer.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp,v
retrieving revision 1.355
diff -a -u -r1.355 NuppelVideoPlayer.cpp
--- NuppelVideoPlayer.cpp 13 Aug 2004 07:56:35 -0000 1.355
+++ NuppelVideoPlayer.cpp 16 Aug 2004 23:28:55 -0000
@@ -1677,6 +1677,10 @@
while (!eof && !killplayer)
{
+ if (nvr_enc && nvr_enc->GetErrorStatus())
+ {
+ killplayer = true;
+ }
if (paused)
{
if (!previously_paused)
More information about the mythtv-dev
mailing list