summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-25 16:34:56 +0200
committerwm4 <wm4@nowhere>2014-10-25 17:20:15 +0200
commit3c9f2bef92c1b78cc1a72dad77223eb210109ece (patch)
treef99446799743c500ce141be68e5e832a8f03dc7c /stream
parentef252b2314474ff29a58674abc3d564ec36162e4 (diff)
downloadmpv-3c9f2bef92c1b78cc1a72dad77223eb210109ece.tar.bz2
mpv-3c9f2bef92c1b78cc1a72dad77223eb210109ece.tar.xz
tv: unqueue buffers correctly (maybe, maybe not)
I clue no idea what I'm doing, but at least it doesn't hang anymore when closing a tv:// stream using a v4l2 loopback device.
Diffstat (limited to 'stream')
-rw-r--r--stream/tvi_v4l2.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index f339b83439..2a2dae76ba 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -1012,11 +1012,13 @@ static int uninit(priv_t *priv)
}
priv->streamon = 0;
- /* unqueue all remaining buffers */
- memset(&buf,0,sizeof(buf));
- buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- buf.memory = V4L2_MEMORY_MMAP;
- while (!v4l2_ioctl(priv->video_fd, VIDIOC_DQBUF, &buf));
+ /* unqueue all remaining buffers (not sure if this code is correct) */
+ for (i = 0; i < priv->mapcount; i++) {
+ if (v4l2_ioctl(priv->video_fd, VIDIOC_DQBUF, &priv->map[i].buf) < 0) {
+ MP_ERR(priv, "%s: VIDIOC_DQBUF failed: %s\n",
+ info.short_name, strerror(errno));
+ }
+ }
}
/* unmap all buffers */