diff -r 73b910014d07 util/gnutv/gnutv_data.c --- a/util/gnutv/gnutv_data.c Sat Jul 05 16:38:32 2008 +0200 +++ b/util/gnutv/gnutv_data.c Thu Jul 10 23:19:48 2008 +0100 @@ -222,19 +238,26 @@ while(!outputthread_shutdown) { if (poll(&pollfd, 1, 1000) != 1) continue; + + // in case of read error, we should not abort in order to minimize the loss of data. + if (pollfd.revents & POLLERR) { if (errno == EINTR) continue; - fprintf(stderr, "DVR device read failure\n"); - return 0; + fprintf(stderr, "DVR device poll failure\n"); + + // This is tipically EOVERFLOW, i.e. dvb internal buffer run out of space + + // The next read will fail too, but it will also clear the error flag in the driver + // so that following reads will succeed } int size = read(dvrfd, buf, sizeof(buf)); if (size < 0) { if (errno == EINTR) continue; - fprintf(stderr, "DVR device read failure\n"); - return 0; + fprintf(stderr, "DVR device read failure. Possible loss of data.\n"); + // The error flag has been cleared, next read should succeed. } written = 0; @@ -243,6 +266,7 @@ if (tmp == -1) { if (errno != EINTR) { fprintf(stderr, "Write error: %m\n"); + // abort loop break; } } else {