[vlc-commits] transcode: check if input has changed before sync check

Ilkka Ollakka git at videolan.org
Sat Nov 23 12:20:46 CET 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Nov 23 13:04:03 2013 +0200| [39a99d25872f64dacd470fda86ba2193a55cda52] | committer: Ilkka Ollakka

transcode: check if input has changed before sync check

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

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

diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index 92a0218..874535c 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -202,6 +202,23 @@ int transcode_audio_process( sout_stream_t *p_stream,
     while( (p_audio_buf = id->p_decoder->pf_decode_audio( id->p_decoder,
                                                           &in )) )
     {
+        /* Check if audio format has changed, and filters need reinit */
+        if( unlikely( ( id->p_decoder->fmt_out.audio.i_rate != p_sys->fmt_audio.i_rate ) ||
+                      ( id->p_decoder->fmt_out.audio.i_physical_channels != p_sys->fmt_audio.i_physical_channels ) ) )
+        {
+            msg_Info( p_stream, "Audio changed, trying to reinitialize filters" );
+            if( id->p_af_chain != NULL )
+                aout_FiltersDelete( (vlc_object_t *)NULL, id->p_af_chain );
+
+            /* decoders don't set audio.i_format, but audio filters use it */
+            id->p_decoder->fmt_out.audio.i_format = id->p_decoder->fmt_out.i_codec;
+            aout_FormatPrepare( &id->p_decoder->fmt_out.audio );
+
+            if( transcode_audio_initialize_filters( p_stream, id, p_sys, &id->p_decoder->fmt_out.audio ) != VLC_SUCCESS )
+                return VLC_EGENERIC;
+
+        }
+
         if( p_sys->b_master_sync )
         {
             mtime_t i_pts = date_Get( &id->interpolated_pts );
@@ -226,23 +243,6 @@ int transcode_audio_process( sout_stream_t *p_stream,
 
         p_audio_buf->i_dts = p_audio_buf->i_pts;
 
-        /* Check if audio format has changed, and filters need reinit */
-        if( unlikely( ( id->p_decoder->fmt_out.audio.i_rate != p_sys->fmt_audio.i_rate ) ||
-                      ( id->p_decoder->fmt_out.audio.i_physical_channels != p_sys->fmt_audio.i_physical_channels ) ) )
-        {
-            msg_Info( p_stream, "Audio changed, trying to reinitialize filters" );
-            if( id->p_af_chain != NULL )
-                aout_FiltersDelete( (vlc_object_t *)NULL, id->p_af_chain );
-
-            /* decoders don't set audio.i_format, but audio filters use it */
-            id->p_decoder->fmt_out.audio.i_format = id->p_decoder->fmt_out.i_codec;
-            aout_FormatPrepare( &id->p_decoder->fmt_out.audio );
-
-            if( transcode_audio_initialize_filters( p_stream, id, p_sys, &id->p_decoder->fmt_out.audio ) != VLC_SUCCESS )
-                return VLC_EGENERIC;
-
-        }
-
         /* Run filter chain */
         p_audio_buf = aout_FiltersPlay( id->p_af_chain, p_audio_buf,
                                         INPUT_RATE_DEFAULT );



More information about the vlc-commits mailing list