[vlc-devel] [PATCH 25/25] packetizer:copy: set the codec id on fmt_out when everything is correct

Steve Lhomme robux4 at videolabs.io
Mon Jul 10 16:52:29 CEST 2017


---
 modules/packetizer/copy.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/packetizer/copy.c b/modules/packetizer/copy.c
index 6d442d9e47..5f74a426ce 100644
--- a/modules/packetizer/copy.c
+++ b/modules/packetizer/copy.c
@@ -93,18 +93,6 @@ static int Open( vlc_object_t *p_this )
     /* Create the output format */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
 
-    /* Fix the value of the fourcc for audio */
-    if( p_dec->fmt_in.i_cat == AUDIO_ES )
-    {
-        p_dec->fmt_out.i_codec = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
-                                                           p_dec->fmt_in.audio.i_bitspersample );
-        if( !p_dec->fmt_out.i_codec )
-        {
-            msg_Err( p_dec, "unknown raw audio sample size" );
-            return VLC_EGENERIC;
-        }
-    }
-
     p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) );
     if (unlikely(p_sys == NULL))
         return VLC_ENOMEM;
@@ -120,6 +108,19 @@ static int Open( vlc_object_t *p_this )
         break;
     }
 
+    /* Fix the value of the fourcc for audio */
+    if( p_dec->fmt_in.i_cat == AUDIO_ES )
+    {
+        vlc_fourcc_t fcc = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
+                                                     p_dec->fmt_in.audio.i_bitspersample );
+        if( !fcc )
+        {
+            msg_Err( p_dec, "unknown raw audio sample size" );
+            return VLC_EGENERIC;
+        }
+        p_dec->fmt_out.i_codec = fcc;
+    }
+
     return VLC_SUCCESS;
 }
 
-- 
2.12.1



More information about the vlc-devel mailing list