[vlc-commits] packetizer: flac: fix draining (#25122)

Francois Cartegnie git at videolan.org
Thu Oct 1 17:09:33 CEST 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Sep 29 11:21:28 2020 +0200| [b80a49b65fef853031ba81e84c1147cb73a62d29] | committer: Francois Cartegnie

packetizer: flac: fix draining (#25122)

(cherry picked from commit eeae1274bf65d41988b83d8b5450d721a97383d9)

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

 modules/packetizer/flac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
index 5218fcb661..6650e03427 100644
--- a/modules/packetizer/flac.c
+++ b/modules/packetizer/flac.c
@@ -497,7 +497,7 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
             p_sys->i_offset = 0;
             p_sys->crc = 0;
 
-            if( block_BytestreamRemaining(&p_sys->bytestream) > 0 )
+            if( block_BytestreamRemaining(&p_sys->bytestream) > 0 || pp_block == NULL /* drain */)
                 p_sys->i_state = STATE_SEND_DATA;
             else
                 p_sys->i_state = STATE_NOSYNC;
@@ -509,8 +509,9 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
         p_dec->fmt_out.audio.i_channels = p_sys->headerinfo.i_channels;
         p_dec->fmt_out.audio.i_physical_channels = pi_channels_maps[p_sys->stream_info.channels];
 
-        if( p_sys->bytestream.p_block->i_pts > date_Get( &p_sys->pts ) &&
-            p_sys->bytestream.p_block->i_pts > VLC_TS_INVALID )
+        if( p_sys->bytestream.p_block &&
+            p_sys->bytestream.p_block->i_pts > date_Get( &p_sys->pts ) &&
+            p_sys->bytestream.p_block->i_pts != VLC_TS_INVALID )
         {
             date_Init( &p_sys->pts, p_sys->headerinfo.i_rate, 1 );
             date_Set( &p_sys->pts, p_sys->bytestream.p_block->i_pts );



More information about the vlc-commits mailing list