[vlc-commits] ytdl: use vlc_read_i11e()
Rémi Denis-Courmont
git at videolan.org
Wed Sep 30 20:53:14 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep 30 21:48:36 2020 +0300| [b47dd251b5a6715cc58b443deb1e7de2400ab1c2] | committer: Rémi Denis-Courmont
ytdl: use vlc_read_i11e()
This will abort should YoutubeDL get stuck waiting for network I/O.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b47dd251b5a6715cc58b443deb1e7de2400ab1c2
---
modules/demux/ytdl.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/modules/demux/ytdl.c b/modules/demux/ytdl.c
index 63b082b4b9..54c722a783 100644
--- a/modules/demux/ytdl.c
+++ b/modules/demux/ytdl.c
@@ -36,6 +36,7 @@
#include <vlc_input_item.h>
#include <vlc_plugin.h>
#include <vlc_spawn.h>
+#include <vlc_interrupt.h>
struct ytdl_json {
struct vlc_logger *logger;
@@ -53,7 +54,14 @@ size_t json_read(void *data, void *buf, size_t size)
{
struct ytdl_json *sys = data;
- return read(sys->fd, buf, size);
+ while (!vlc_killed()) {
+ ssize_t val = vlc_read_i11e(sys->fd, buf, size);
+
+ if (val >= 0)
+ return val;
+ }
+
+ return 0;
}
static int ytdl_popen(pid_t *restrict pid, const char *argv[])
@@ -398,8 +406,10 @@ static int OpenCommon(vlc_object_t *obj)
}
}
- if (demux == NULL)
+ if (demux == NULL) {
+ json_free(&sys->json);
return VLC_EGENERIC;
+ }
s->pf_demux = DemuxNested;
s->pf_control = ControlNested;
More information about the vlc-commits
mailing list