vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Tue Jun 12 
18:16:11 2018 +0200| [5daf4fe95f1d8d5cbc523dd763cf6f9405327bd1] | committer: 
Francois Cartegnie

packetizer: mpeg4audio: fix discontinuity check

triggering discontinuity on every packet with
some streams, depending on preroll

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

 modules/packetizer/mpeg4audio.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 9237853a3e..9f5fe4532b 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -329,11 +329,12 @@ static block_t *ForwardRawBlock(decoder_t *p_dec, block_t 
**pp_block)
     p_block = *pp_block;
     *pp_block = NULL; /* Don't reuse this block */
 
+    int64_t i_diff = 0;
     if (p_block->i_pts != VLC_TS_INVALID &&
         p_block->i_pts != date_Get(&p_sys->end_date))
     {
         if(date_Get(&p_sys->end_date) != VLC_TS_INVALID)
-            p_sys->b_discontuinity = true;
+            i_diff = llabs( date_Get(&p_sys->end_date) - p_block->i_pts );
         date_Set(&p_sys->end_date, p_block->i_pts);
     }
 
@@ -341,10 +342,15 @@ static block_t *ForwardRawBlock(decoder_t *p_dec, block_t 
**pp_block)
 
     /* Might not be known due to missing extradata,
        will be set to block pts above */
-    if(p_dec->fmt_out.audio.i_frame_length)
+    if(p_dec->fmt_out.audio.i_frame_length && p_block->i_pts != VLC_TS_INVALID)
+    {
         p_block->i_length = date_Increment(&p_sys->end_date,
             p_dec->fmt_out.audio.i_frame_length) - p_block->i_pts;
 
+        if( i_diff > p_block->i_length )
+            p_sys->b_discontuinity = true;
+    }
+
     return p_block;
 }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to