[vlc-commits] transcode/audio: init muxer format lately

Thomas Guillem git at videolan.org
Fri Jan 19 12:01:40 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 18 16:57:18 2018 +0100| [6894306cbde9afa80633990c927ad32fb87a330d] | committer: Jean-Baptiste Kempf

transcode/audio: init muxer format lately

This can fix channels (or other params) mismatch when decoders update their
fmt_out lately. This is the case for dts-hd for example (first decoder/encoder
initialisation gives 5.1, then 7.1).

(cherry picked from commit 91c3b27efe79f076aed42b83986a36d7bdec126d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_out/transcode/audio.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 577378ecea..c60569a26f 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -307,6 +307,13 @@ int transcode_audio_process( sout_stream_t *p_stream,
             }
             date_Init( &id->next_input_pts, id->audio_dec_out.i_rate, 1 );
             date_Set( &id->next_input_pts, p_audio_buf->i_pts );
+
+            if (!id->id)
+            {
+                id->id = sout_StreamIdAdd( p_stream->p_next, &id->p_encoder->fmt_out );
+                if (!id->id)
+                    id->b_transcode = false;
+            }
         }
 
         /* Check if audio format has changed, and filters need reinit */
@@ -426,15 +433,8 @@ bool transcode_audio_add( sout_stream_t *p_stream, const es_format_t *p_fmt,
     }
 
     /* Open output stream */
-    id->id = sout_StreamIdAdd( p_stream->p_next, &id->p_encoder->fmt_out );
     id->b_transcode = true;
 
-    if( !id->id )
-    {
-        transcode_audio_close( id );
-        return false;
-    }
-
     /* Reinit encoder again later on, when all information from decoders
      * is available. */
     if( id->p_encoder->p_module )



More information about the vlc-commits mailing list