Commit 77f0dfe2 authored by Thomas Guillem's avatar Thomas Guillem Committed by Jean-Baptiste Kempf

transcode: change error handling

Don't reset b_transcode to false in case of error, otherwise transcoding
resources won't be freed.

(cherry picked from commit 67e99316)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 9354540a
......@@ -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:
......
......@@ -583,6 +583,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 )
......
......@@ -73,6 +73,7 @@ struct aout_filters;
struct sout_stream_id_sys_t
{
bool b_transcode;
bool b_error;
/* id of the out stream */
void *id;
......
......@@ -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 ) )
......@@ -428,7 +425,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,
......@@ -776,7 +772,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;
......@@ -862,8 +858,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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment