[vlc-commits] test: input: fix test_decoder_destroy
Thomas Guillem
git at videolan.org
Sun Nov 12 18:43:20 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Nov 12 18:41:08 2017 +0100| [24c731a896429a2b63576e86462200ad115bc99e] | committer: Thomas Guillem
test: input: fix test_decoder_destroy
Behave like the one in the core:
- clean decoder->p_description
- clean fmt_out only in case of success
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=24c731a896429a2b63576e86462200ad115bc99e
---
test/src/input/decoder.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/test/src/input/decoder.c b/test/src/input/decoder.c
index 1de05af4a4..37df145607 100644
--- a/test/src/input/decoder.c
+++ b/test/src/input/decoder.c
@@ -29,6 +29,7 @@
#include <vlc_codec.h>
#include <vlc_stream.h>
#include <vlc_access.h>
+#include <vlc_meta.h>
#include <vlc_block.h>
#include <vlc_url.h>
@@ -81,23 +82,27 @@ static int queue_sub(decoder_t *dec, subpicture_t *p_subpic)
return 0;
}
-void test_decoder_destroy(decoder_t *decoder)
+static void decoder_unload(decoder_t *decoder)
{
- decoder_t *packetizer = (void *) decoder->p_owner;
-
- if (packetizer->p_module != NULL)
- module_unneed(packetizer, packetizer->p_module);
- es_format_Clean(&packetizer->fmt_in);
- es_format_Clean(&packetizer->fmt_out);
- vlc_object_release(packetizer);
-
if (decoder->p_module != NULL)
+ {
module_unneed(decoder, decoder->p_module);
+ es_format_Clean(&decoder->fmt_out);
+ }
es_format_Clean(&decoder->fmt_in);
- es_format_Clean(&decoder->fmt_out);
+ if (decoder->p_description)
+ vlc_meta_Delete(decoder->p_description);
vlc_object_release(decoder);
}
+void test_decoder_destroy(decoder_t *decoder)
+{
+ decoder_t *packetizer = (void *) decoder->p_owner;
+
+ decoder_unload(packetizer);
+ decoder_unload(decoder);
+}
+
decoder_t *test_decoder_create(vlc_object_t *parent, const es_format_t *fmt)
{
assert(parent && fmt);
More information about the vlc-commits
mailing list