[MPlayer-cvslog] r37748 - trunk/stream/stream_pvr.c

reimar subversion at mplayerhq.hu
Sat Feb 20 11:47:39 CET 2016


Author: reimar
Date: Sat Feb 20 11:47:39 2016
New Revision: 37748

Log:
stream_pvr: fix bogus error message on device poll timeout

The error check for the call to poll() should actually be for the
subsequent read(). Move it there.

Add a different check for poll(), to correctly report timeout.

Signed-off-by: Reza Arbab <arbab at panix.com>

Patch by Reza Arbab [arbab panix.com]

Modified:
   trunk/stream/stream_pvr.c

Modified: trunk/stream/stream_pvr.c
==============================================================================
--- trunk/stream/stream_pvr.c	Sat Feb 20 11:47:37 2016	(r37747)
+++ trunk/stream/stream_pvr.c	Sat Feb 20 11:47:39 2016	(r37748)
@@ -1630,9 +1630,15 @@ pvr_stream_read (stream_t *stream, char
     pfds[0].fd = fd;
     pfds[0].events = POLLIN | POLLPRI;
 
-    rk = size - pos;
+    if (!poll (pfds, 1, 500))
+    {
+      mp_msg (MSGT_OPEN, MSGL_ERR,
+              "%s 500ms timeout polling stream device\n", LOG_LEVEL_PVR);
+      return -1;
+    }
 
-    if (poll (pfds, 1, 500) <= 0)
+    rk = read (fd, &buffer[pos], size-pos);
+    if (rk < 0)
     {
       mp_msg (MSGT_OPEN, MSGL_ERR,
               "%s failed with errno %d when reading %d bytes\n",
@@ -1640,13 +1646,12 @@ pvr_stream_read (stream_t *stream, char
       break;
     }
 
-    rk = read (fd, &buffer[pos], rk);
-    if (rk > 0)
-    {
-      pos += rk;
-      mp_msg (MSGT_OPEN, MSGL_DBG3,
-              "%s read (%d) bytes\n", LOG_LEVEL_PVR, pos);
-    }
+    if (!rk)
+      break;
+
+    pos += rk;
+    mp_msg (MSGT_OPEN, MSGL_DBG3,
+            "%s read (%d) bytes\n", LOG_LEVEL_PVR, pos);
   }
 
   if (!pos)


More information about the MPlayer-cvslog mailing list