summaryrefslogtreecommitdiff
path: root/recorder.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-05-16 13:36:06 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2003-05-16 13:36:06 +0200
commite944312b655cc8354bea9df1de282314618241a4 (patch)
tree2ef4ad322ae05727b636c90afc6d5c0efa9365de /recorder.c
parent0e10fc9599e232505832beece901390265d731d7 (diff)
downloadvdr-e944312b655cc8354bea9df1de282314618241a4.tar.gz
vdr-e944312b655cc8354bea9df1de282314618241a4.tar.bz2
Moved the detection of a broken video data stream from the cDevice into the cRecorder
Diffstat (limited to 'recorder.c')
-rw-r--r--recorder.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/recorder.c b/recorder.c
index 15e86463..d7cc9c31 100644
--- a/recorder.c
+++ b/recorder.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recorder.c 1.5 2003/01/25 16:23:36 kls Exp $
+ * $Id: recorder.c 1.6 2003/05/16 13:33:04 kls Exp $
*/
#include <stdarg.h>
@@ -16,6 +16,10 @@
// (must be larger than MINVIDEODATA - see remux.h)
#define VIDEOBUFSIZE MEGABYTE(5)
+// The maximum time we wait before assuming that a recorded video data stream
+// is broken:
+#define MAXBROKENTIMEOUT 30 // seconds
+
#define MINFREEDISKSPACE (512) // MB
#define DISKCHECKINTERVAL 100 // seconds
@@ -110,6 +114,7 @@ void cRecorder::Action(void)
{
dsyslog("recording thread started (pid=%d)", getpid());
+ time_t t = time(NULL);
active = true;
while (active) {
int r;
@@ -134,6 +139,12 @@ void cRecorder::Action(void)
else
break;
}
+ t = time(NULL);
+ }
+ else if (time(NULL) - t > MAXBROKENTIMEOUT) {
+ esyslog("ERROR: video data stream broken");
+ cThread::EmergencyExit(true);
+ t = time(NULL);
}
else
usleep(1); // this keeps the CPU load low