public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea <mariofutire@googlemail.com>
To: linux-dvb@linuxtv.org
Subject: [linux-dvb] [PATCH] how to make gnutv more resilient
Date: Sun, 24 Feb 2008 22:57:43 +0000	[thread overview]
Message-ID: <47C1F667.8060602@googlemail.com> (raw)

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

                 reply	other threads:[~2008-02-24 22:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C1F667.8060602@googlemail.com \
    --to=mariofutire@googlemail.com \
    --cc=linux-dvb@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox