[vlc-devel] [PATCH 1/2] test: demux-run: add libvlc_demux_process_memory

Rémi Denis-Courmont remi at remlab.net
Thu Feb 21 06:57:23 CET 2019


Hi,

This would work properly if demuxers never modified the configuration, or texl'heir parent objects, etc. But because some of them do (AFAIR), this leaks unreproducible state into the testing.

Which would somewhat obviously be a very bad thing.

Le 20 février 2019 19:40:07 GMT+02:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>Same than vlc_demux_process_memory but with a libvlc_instance_t arg.
>---
> test/src/input/demux-run.c | 19 +++++++++++++------
> test/src/input/demux-run.h |  3 +++
> 2 files changed, 16 insertions(+), 6 deletions(-)
>
>diff --git a/test/src/input/demux-run.c b/test/src/input/demux-run.c
>index fe9ce530b5..8178756ed6 100644
>--- a/test/src/input/demux-run.c
>+++ b/test/src/input/demux-run.c
>@@ -363,6 +363,18 @@ int vlc_demux_process_path(const struct
>vlc_run_args *args, const char *path)
>     return ret;
> }
> 
>+int libvlc_demux_process_memory(libvlc_instance_t *vlc,
>+                                const struct vlc_run_args *args,
>+                                const unsigned char *buf, size_t
>length)
>+{
>+    stream_t *s = vlc_stream_MemoryNew(VLC_OBJECT(vlc->p_libvlc_int),
>+                                       (void *)buf, length, true);
>+    if (s == NULL)
>+        fprintf(stderr, "Error: cannot create input stream\n");
>+
>+    return demux_process_stream(args, s);
>+}
>+
> int vlc_demux_process_memory(const struct vlc_run_args *args,
>                              const unsigned char *buf, size_t length)
> {
>@@ -370,12 +382,7 @@ int vlc_demux_process_memory(const struct
>vlc_run_args *args,
>     if (vlc == NULL)
>         return -1;
> 
>-    stream_t *s = vlc_stream_MemoryNew(VLC_OBJECT(vlc->p_libvlc_int),
>-                                       (void *)buf, length, true);
>-    if (s == NULL)
>-        fprintf(stderr, "Error: cannot create input stream\n");
>-
>-    int ret = demux_process_stream(args, s);
>+    int ret = libvlc_demux_process_memory(vlc, args, buf, length);
>     libvlc_release(vlc);
>     return ret;
> }
>diff --git a/test/src/input/demux-run.h b/test/src/input/demux-run.h
>index 01ae245891..551f002770 100644
>--- a/test/src/input/demux-run.h
>+++ b/test/src/input/demux-run.h
>@@ -30,3 +30,6 @@ int vlc_demux_process_url(const struct vlc_run_args
>*, const char *url);
>int vlc_demux_process_path(const struct vlc_run_args *, const char
>*path);
> int vlc_demux_process_memory(const struct vlc_run_args *,
>                              const unsigned char *buf, size_t length);
>+int libvlc_demux_process_memory(libvlc_instance_t *vlc,
>+                                const struct vlc_run_args *args,
>+                                const unsigned char *buf, size_t
>length);
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190221/9272bf58/attachment.html>


More information about the vlc-devel mailing list