[vlc-commits] transcode: reorder encoder closing
Francois Cartegnie
git at videolan.org
Mon Jul 9 16:15:23 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun 24 16:02:45 2018 +0200| [9af1ff74f4060262e654f5a18117a74ac0917e5f] | committer: Francois Cartegnie
transcode: reorder encoder closing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9af1ff74f4060262e654f5a18117a74ac0917e5f
---
modules/stream_out/transcode/video.c | 48 ++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ceb704e05c..d1d40051e7 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -625,6 +625,28 @@ static void transcode_video_encoder_configure( sout_stream_t *p_stream,
(const char *)&p_enc_in->i_chroma);
}
+static void transcode_video_encoder_close( sout_stream_t *p_stream,
+ sout_stream_id_sys_t *id )
+{
+ sout_stream_sys_t *p_sys = p_stream->p_sys;
+ if( p_sys->i_threads >= 1 && !id->b_abort )
+ {
+ vlc_mutex_lock( &id->lock_out );
+ id->b_abort = true;
+ vlc_cond_signal( &id->cond );
+ vlc_mutex_unlock( &id->lock_out );
+
+ vlc_join( id->thread, NULL );
+ }
+
+ /* Close encoder */
+ if( id->p_encoder->p_module )
+ {
+ module_unneed( id->p_encoder, id->p_encoder->p_module );
+ id->p_encoder->p_module = NULL;
+ }
+}
+
static int transcode_video_encoder_open( sout_stream_t *p_stream,
sout_stream_id_sys_t *id )
{
@@ -665,15 +687,15 @@ void transcode_video_close( sout_stream_t *p_stream,
sout_stream_id_sys_t *id )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
- if( p_sys->i_threads >= 1 && !id->b_abort )
- {
- vlc_mutex_lock( &id->lock_out );
- id->b_abort = true;
- vlc_cond_signal( &id->cond );
- vlc_mutex_unlock( &id->lock_out );
- vlc_join( id->thread, NULL );
- }
+ /* Close decoder */
+ if( id->p_decoder->p_module )
+ module_unneed( id->p_decoder, id->p_decoder->p_module );
+ if( id->p_decoder->p_description )
+ vlc_meta_Delete( id->p_decoder->p_description );
+
+ /* Close encoder */
+ transcode_video_encoder_close( p_stream, id );
if( p_sys->i_threads >= 1 )
{
@@ -684,16 +706,6 @@ void transcode_video_close( sout_stream_t *p_stream,
vlc_cond_destroy( &id->cond );
}
- /* Close decoder */
- if( id->p_decoder->p_module )
- module_unneed( id->p_decoder, id->p_decoder->p_module );
- if( id->p_decoder->p_description )
- vlc_meta_Delete( id->p_decoder->p_description );
-
- /* Close encoder */
- if( id->p_encoder->p_module )
- module_unneed( id->p_encoder, id->p_encoder->p_module );
-
es_format_Clean( &id->encoder_tested_fmt_in );
/* Close filters */
More information about the vlc-commits
mailing list