[vlc-commits] packetizer:copy: set the codec id on fmt_out when everything is correct

Steve Lhomme git at videolan.org
Wed Jul 12 12:23:40 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Jul 10 16:36:22 2017 +0200| [cdf2f061e65853688789291a3828b2146b4c7e54] | committer: Jean-Baptiste Kempf

packetizer:copy: set the codec id on fmt_out when everything is correct

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdf2f061e65853688789291a3828b2146b4c7e54
---

 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;
 }
 



More information about the vlc-commits mailing list