[vlc-devel] [PATCH] a52: ensure that sample rate is initialized

RĂ©mi Denis-Courmont remi at remlab.net
Sun Nov 12 12:01:13 CET 2017


---
 modules/packetizer/a52.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/packetizer/a52.c b/modules/packetizer/a52.c
index 0404f78a01..93c24d2324 100644
--- a/modules/packetizer/a52.c
+++ b/modules/packetizer/a52.c
@@ -30,6 +30,8 @@
 # include "config.h"
 #endif
 
+#include <assert.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
@@ -64,7 +66,6 @@ struct decoder_sys_t
      * Common properties
      */
     date_t  end_date;
-    bool    b_date_set;
 
     mtime_t i_pts;
     bool    b_discontuinity;
@@ -86,15 +87,15 @@ static block_t *GetOutBuffer( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( !p_sys->b_date_set
+    if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID
      || p_dec->fmt_out.audio.i_rate != p_sys->frame.i_rate )
     {
         msg_Dbg( p_dec, "A/52 channels:%d samplerate:%d bitrate:%d",
                  p_sys->frame.i_channels, p_sys->frame.i_rate, p_sys->frame.i_bitrate );
 
+        assert( p_sys->frame.i_rate );
         date_Init( &p_sys->end_date, p_sys->frame.i_rate, 1 );
         date_Set( &p_sys->end_date, p_sys->i_pts );
-        p_sys->b_date_set = true;
     }
 
     p_dec->fmt_out.audio.i_rate     = p_sys->frame.i_rate;
@@ -328,9 +329,8 @@ static int Open( vlc_object_t *p_this )
 
     /* Misc init */
     p_sys->i_state = STATE_NOSYNC;
-    date_Set( &p_sys->end_date, 0 );
+    date_Set( &p_sys->end_date, VLC_TS_INVALID );
     p_sys->i_pts = VLC_TS_INVALID;
-    p_sys->b_date_set = false;
     p_sys->b_discontuinity = false;
     memset(&p_sys->frame, 0, sizeof(vlc_a52_header_t));
 
-- 
2.15.0



More information about the vlc-devel mailing list