Commit 3b0c2208 authored by Ilkka Ollakka's avatar Ilkka Ollakka

avcodec: check if we need to padd last frame

Should Fix #8539
parent 3ae38645
...@@ -1148,6 +1148,15 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf ) ...@@ -1148,6 +1148,15 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
p_aout_buf->i_buffer -= leftover; p_aout_buf->i_buffer -= leftover;
p_aout_buf->i_pts = date_Get( &p_sys->buffer_date ); p_aout_buf->i_pts = date_Get( &p_sys->buffer_date );
} }
if(unlikely( ( (leftover + buffer_delay) < p_sys->i_buffer_out ) &&
!(p_sys->p_codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME ))
)
{
msg_Dbg( p_enc, "No small last frame support, padding");
size_t padding_size = p_sys->i_buffer_out - (leftover+buffer_delay);
memset( p_sys->p_buffer + (leftover+buffer_delay), 0, padding_size );
buffer_delay += padding_size;
}
if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_in.audio.i_channels, if( avcodec_fill_audio_frame( p_sys->frame, p_enc->fmt_in.audio.i_channels,
p_sys->p_context->sample_fmt, p_sys->p_buffer, p_sys->p_context->sample_fmt, p_sys->p_buffer,
leftover + buffer_delay, leftover + buffer_delay,
......
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