[vlc-devel] [RFC PATCH] input/decoder: copy-initialize decoder_t.fmt_out in LoadDecoder

Filip Roséen filip at videolabs.io
Tue Jul 12 00:56:33 CEST 2016


Given that there are certain entities within the "es_format_t" that a
decoder normally cannot know about (such as "es_format_t.psz_description"),
this patch copy-initializes "p_dec->fmt_out" with data coming from the
demuxer* prior to creating the packetizer/decoder.

This patch fixes a bug where metadata associated with a track would go
missing when it is being played (because EsOutUpdateInfo is indirectly
called with an es_format_t lacking such data).

* or previous packetizer

--

This patch is marked as RFC because I do not know if a decoder can make
certain assumptions regarding the state of p_dec->fmt_out (such as
assuming that all data-members that requires a free are NULL).

    - Can someone please enlighten me on this matter?
    - Is there a better way to solve this problem?

Thank you.
---
 src/input/decoder.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 06e569d..2b900bd 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -151,7 +151,7 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
     p_dec->pf_flush = NULL;
 
     es_format_Copy( &p_dec->fmt_in, p_fmt );
-    es_format_Init( &p_dec->fmt_out, UNKNOWN_ES, 0 );
+    es_format_Copy( &p_dec->fmt_out, p_fmt );
 
     /* Find a suitable decoder/packetizer module */
     if( !b_packetizer )
@@ -162,6 +162,7 @@ static int LoadDecoder( decoder_t *p_dec, bool b_packetizer,
     if( !p_dec->p_module )
     {
         es_format_Clean( &p_dec->fmt_in );
+        es_format_Clean( &p_dec->fmt_out );
         return -1;
     }
     else
-- 
2.9.0



More information about the vlc-devel mailing list