transcode: fix picture fifo leak
authorAlaric Senat <alaric@videolabs.io>
Mon, 24 Jun 2024 16:11:59 +0000 (18:11 +0200)
committerSebastian Ramacher <sramacher@debian.org>
Tue, 14 Jan 2025 22:09:47 +0000 (23:09 +0100)
Draining sets the abort flag. It was skipping the picture fifo deletion
before.

Gbp-Pq: Name 0009-transcode-fix-picture-fifo-leak.patch

modules/stream_out/transcode/video.c

index e2065af09e38489806cd6292eac1dbd7ae4b1a51..c6fe9a571a25d84e1bb6a6d120406891fc4af8fb 100644 (file)
@@ -658,17 +658,20 @@ static int transcode_video_encoder_open( sout_stream_t *p_stream,
 void transcode_video_close( sout_stream_t *p_stream,
                                    sout_stream_id_sys_t *id )
 {
-    if( p_stream->p_sys->i_threads >= 1 && !p_stream->p_sys->b_abort )
+    if( p_stream->p_sys->i_threads >= 1 )
     {
-        vlc_mutex_lock( &p_stream->p_sys->lock_out );
-        p_stream->p_sys->b_abort = true;
-        vlc_cond_signal( &p_stream->p_sys->cond );
-        vlc_mutex_unlock( &p_stream->p_sys->lock_out );
+        if (!p_stream->p_sys->b_abort)
+        {
+            vlc_mutex_lock( &p_stream->p_sys->lock_out );
+            p_stream->p_sys->b_abort = true;
+            vlc_cond_signal( &p_stream->p_sys->cond );
+            vlc_mutex_unlock( &p_stream->p_sys->lock_out );
 
-        vlc_join( p_stream->p_sys->thread, NULL );
+            vlc_join( p_stream->p_sys->thread, NULL );
+            block_ChainRelease( p_stream->p_sys->p_buffers );
+        }
 
         picture_fifo_Delete( p_stream->p_sys->pp_pics );
-        block_ChainRelease( p_stream->p_sys->p_buffers );
     }
 
     if( p_stream->p_sys->i_threads >= 1 )