1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
From: Alaric Senat <alaric@videolabs.io>
Date: Mon, 24 Jun 2024 18:11:59 +0200
Subject: transcode: fix picture fifo leak
Draining sets the abort flag. It was skipping the picture fifo deletion
before.
---
modules/stream_out/transcode/video.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index e2065af..c6fe9a5 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -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 )
|