Skip to content

Commit

Permalink
stream_pvr: increase timeout, slightly better error reporting
Browse files Browse the repository at this point in the history
An attempt to find out what's wrong with issue #1382.

I don't even know why a timeout would be needed; for robustness with
broken devices maybe?
  • Loading branch information
wm4 authored and Diogo Franco (Kovensky) committed Jan 24, 2015
1 parent db9b7ff commit 9abc8cf
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions stream/stream_pvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ get_v4l2_freq (struct pvr_t *pvr)

if (ioctl (pvr->dev_fd, VIDIOC_G_FREQUENCY, &vf) < 0)
{
MP_ERR(pvr, "%s can't get frequency %d.\n",
LOG_LEVEL_V4L2, errno);
MP_ERR(pvr, "%s can't get frequency (%s).\n",
LOG_LEVEL_V4L2, mp_strerror(errno));
return -1;
}
freq = vf.frequency;
Expand Down Expand Up @@ -1491,10 +1491,15 @@ pvr_stream_read (stream_t *stream, char *buffer, int size)

rk = size - pos;

if (poll (pfds, 1, 500) <= 0)
int r = poll(pfds, 1, 5000);
if (r <= 0)
{
MP_ERR(pvr, "%s failed with errno %d when reading %d bytes\n",
LOG_LEVEL_PVR, errno, size-pos);
if (r < 0) {
MP_ERR(pvr, "%s failed with '%s' when reading %d bytes\n",
LOG_LEVEL_PVR, mp_strerror(errno), size-pos);
} else {
MP_ERR(pvr, "timeout when trying to read from device\n");
}
break;
}

Expand Down

0 comments on commit 9abc8cf

Please sign in to comment.