From: Alaric Senat Date: Mon, 24 Jun 2024 16:11:23 +0000 (+0200) Subject: transcode: fix destructive assignment after drain X-Git-Tag: archive/raspbian/3.0.21-6+rpi1^2~117 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=acc1d516946765206cfebe083a1cfe9aaea44c35;p=vlc.git transcode: fix destructive assignment after drain The drain checks are done after the first encoder output fetch. At this point, `out` is already filled with some frames gotten from the encoder some lines above: ``` // ... if( p_sys->i_threads >= 1 ) { /* Pick up any return data the encoder thread wants to output. */ vlc_mutex_lock( &p_sys->lock_out ); *out = p_sys->p_buffers; p_sys->p_buffers = NULL; vlc_mutex_unlock( &p_sys->lock_out ); } // ... ``` This assignment currently leaks all previously gathered frames to replace them by the drained output. This patch appends the drained frames to the existing output instead. Gbp-Pq: Name 0008-transcode-fix-destructive-assignment-after-drain.patch --- diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c index 9070babb..e2065af0 100644 --- a/modules/stream_out/transcode/video.c +++ b/modules/stream_out/transcode/video.c @@ -906,7 +906,7 @@ end: vlc_join( p_stream->p_sys->thread, NULL ); vlc_mutex_lock( &p_sys->lock_out ); - *out = p_sys->p_buffers; + block_ChainAppend(out, p_sys->p_buffers); p_sys->p_buffers = NULL; vlc_mutex_unlock( &p_sys->lock_out );