[vlc-commits] avcodec: set frame samples to 0 if frame fill fails in encode, this way encode_audio2 doesn't crash
Ilkka Ollakka
git at videolan.org
Fri Aug 16 15:01:17 CEST 2013
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Fri Aug 16 15:59:00 2013 +0300| [8cf359215dd9f44b0bb7648a4dcdeecd89380bdc] | committer: Ilkka Ollakka
avcodec: set frame samples to 0 if frame fill fails in encode, this way encode_audio2 doesn't crash
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8cf359215dd9f44b0bb7648a4dcdeecd89380bdc
---
modules/codec/avcodec/encoder.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 7688ecd..f14d898 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -1157,7 +1157,10 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
p_sys->p_context->sample_fmt, p_sys->b_planar ? p_sys->p_interleave_buf : p_sys->p_buffer,
leftover + buffer_delay,
align) < 0 )
+ {
msg_Err( p_enc, "filling error on fillup" );
+ p_sys->frame->nb_samples = 0;
+ }
buffer_delay = 0;
p_sys->i_samples_delay = 0;
@@ -1250,7 +1253,10 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
p_sys->b_planar ? p_sys->p_buffer : p_aout_buf->p_buffer,
__MIN(p_sys->i_buffer_out, p_aout_buf->i_buffer),
align) < 0 )
+ {
msg_Err( p_enc, "filling error on encode" );
+ p_sys->frame->nb_samples = 0;
+ }
p_aout_buf->p_buffer += (p_sys->frame->nb_samples * p_enc->fmt_in.audio.i_channels * p_sys->i_sample_bytes);
p_aout_buf->i_buffer -= (p_sys->frame->nb_samples * p_enc->fmt_in.audio.i_channels * p_sys->i_sample_bytes);
More information about the vlc-commits
mailing list