All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-dvb] [PATCH] how to make gnutv more resilient
@ 2008-02-24 22:57 Andrea
  0 siblings, 0 replies; only message in thread
From: Andrea @ 2008-02-24 22:57 UTC (permalink / raw)
  To: linux-dvb

Hi,

I usually save TV to a network disk using gnutv.
Sometimes I get

"DVR device read failure"

The network is wireless, I'm using 54 Mb/s which should be more that enough for at least 1 channel.
Sometimes though, under heavy load it stops.
I think some network congestion makes gnutv read too slowly from dvr0 so that it breaks.

I would rather loose a couple of frames instead than everything after that point.

The patch does 2 things

1) removes poll. I don't knot it much, but once it fails, it keeps failing. While read can go back 
to normal after a read failure. To be honest I don't know why it is there.

2) instead of returning from the function we just skip and continue.

I've tested it adding a sleep(3) every 20 seconds and the file I get is not perfect, but can be 
played in mplayer with a bad frame every 20 seconds (as expected).

I thought in the beginning that I should read/write multiples of 188 bytes, but mplayer seems not to 
bother about that.

What do you think?

diff -r 29e190fef1e3 util/gnutv/gnutv_data.c
--- a/util/gnutv/gnutv_data.c   Tue Feb 12 18:01:37 2008 +0100
+++ b/util/gnutv/gnutv_data.c   Sun Feb 24 22:47:11 2008 +0000
@@ -213,28 +213,15 @@ static void *fileoutputthread_func(void*
  {
         (void)arg;
         uint8_t buf[4096];
-       struct pollfd pollfd;
         int written;

-       pollfd.fd = dvrfd;
-       pollfd.events = POLLIN|POLLPRI|POLLERR;
-
         while(!outputthread_shutdown) {
-               if (poll(&pollfd, 1, 1000) != 1)
-                       continue;
-               if (pollfd.revents & POLLERR) {
-                       if (errno == EINTR)
-                               continue;
-                       fprintf(stderr, "DVR device read failure\n");
-                       return 0;
-               }
-
                 int size = read(dvrfd, buf, sizeof(buf));
                 if (size < 0) {
                         if (errno == EINTR)
                                 continue;
                         fprintf(stderr, "DVR device read failure\n");
-                       return 0;
+                       continue;
                 }

                 written = 0;

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-24 22:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 22:57 [linux-dvb] [PATCH] how to make gnutv more resilient Andrea

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.