1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-26 18:32:08 +00:00

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.
This commit is contained in:
wm4 2014-10-25 16:34:56 +02:00
parent ef252b2314
commit 3c9f2bef92

View File

@ -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 */