[vlc-commits] packetizer: mpeg4audio: fix discontinuity check

Francois Cartegnie git at videolan.org
Wed Jun 13 17:58:37 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 12 18:16:11 2018 +0200| [241b31178ea078cd22803369b2adaf15831fcf8a] | committer: Francois Cartegnie

packetizer: mpeg4audio: fix discontinuity check

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

(cherry picked from commit 5daf4fe95f1d8d5cbc523dd763cf6f9405327bd1)

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

 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 eb39e70eb3..b3a12ab2e9 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;
 }
 



More information about the vlc-commits mailing list