[vlc-commits] transcode: change error handling
Thomas Guillem
git at videolan.org
Fri Jan 19 08:37:13 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 19 08:31:53 2018 +0100| [67e993164249d81bb38bf3f3030238d04d36b176] | committer: Thomas Guillem
transcode: change error handling
Don't reset b_transcode to false in case of error, otherwise transcoding
resources won't be freed.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67e993164249d81bb38bf3f3030238d04d36b176
---
modules/stream_out/transcode/audio.c | 17 +++++++++--------
modules/stream_out/transcode/transcode.c | 3 +++
modules/stream_out/transcode/transcode.h | 1 +
modules/stream_out/transcode/video.c | 9 ++-------
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/modules/stream_out/transcode/audio.c b/modules/stream_out/transcode/audio.c
index c60569a26f..c7ce848239 100644
--- a/modules/stream_out/transcode/audio.c
+++ b/modules/stream_out/transcode/audio.c
@@ -285,7 +285,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
p_audio_bufs = p_audio_bufs->p_next;
p_audio_buf->p_next = NULL;
- if( b_error )
+ if( id->b_error )
{
block_Release( p_audio_buf );
continue;
@@ -312,7 +312,10 @@ int transcode_audio_process( sout_stream_t *p_stream,
{
id->id = sout_StreamIdAdd( p_stream->p_next, &id->p_encoder->fmt_out );
if (!id->id)
- id->b_transcode = false;
+ {
+ vlc_mutex_unlock(&id->fifo.lock);
+ goto error;
+ }
}
}
@@ -365,10 +368,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
p_audio_buf = aout_FiltersPlay( id->p_af_chain, p_audio_buf,
INPUT_RATE_DEFAULT );
if( !p_audio_buf )
- {
- b_error = true;
- continue;
- }
+ goto error;
p_audio_buf->i_dts = p_audio_buf->i_pts;
@@ -378,8 +378,9 @@ int transcode_audio_process( sout_stream_t *p_stream,
block_Release( p_audio_buf );
continue;
error:
- block_Release( p_audio_buf );
- b_error = true;
+ if( p_audio_buf )
+ block_Release( p_audio_buf );
+ id->b_error = true;
} while( p_audio_bufs );
end:
diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index ced21cff37..9cd403f4f6 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -586,6 +586,9 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
{
block_t *p_out = NULL;
+ if( id->b_error )
+ goto error;
+
if( !id->b_transcode )
{
if( id->id )
diff --git a/modules/stream_out/transcode/transcode.h b/modules/stream_out/transcode/transcode.h
index 144502a9c2..3c76a3d53f 100644
--- a/modules/stream_out/transcode/transcode.h
+++ b/modules/stream_out/transcode/transcode.h
@@ -75,6 +75,7 @@ struct aout_filters;
struct sout_stream_id_sys_t
{
bool b_transcode;
+ bool b_error;
/* id of the out stream */
void *id;
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index e26fc99576..fbe7475d42 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -61,9 +61,6 @@ static int video_update_format_decoder( decoder_t *p_dec )
.sys = sys,
};
- if( !id->b_transcode )
- return 0;
-
if( id->p_encoder->fmt_in.i_codec == p_dec->fmt_out.i_codec ||
video_format_IsSimilar( &id->video_dec_out,
&p_dec->fmt_out.video ) )
@@ -434,7 +431,6 @@ static void transcode_video_framerate_init( sout_stream_t *p_stream,
id->p_decoder->fmt_out.video.i_frame_rate_base,
id->p_encoder->fmt_in.video.i_frame_rate,
id->p_encoder->fmt_in.video.i_frame_rate_base );
-
}
static void transcode_video_size_init( sout_stream_t *p_stream,
@@ -782,7 +778,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
p_pics = p_pics->p_next;
p_pic->p_next = NULL;
- if( b_error )
+ if( id->b_error )
{
picture_Release( p_pic );
continue;
@@ -868,8 +864,7 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
error:
if( p_pic )
picture_Release( p_pic );
- id->b_transcode = false;
- b_error = true;
+ id->b_error = true;
} while( p_pics );
if( p_sys->i_threads >= 1 )
More information about the vlc-commits
mailing list