Commit caf2a08a authored by Martin Storsjö's avatar Martin Storsjö Committed by Jean-Baptiste Kempf

avcodec: Set time_base for audio encoders, too

This is required when encoding audio in libav 0.8, otherwise
it will crash due to a division by zero.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 25fc1243b81a46a100e37db5ec477bd5096b979a)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent c2c945cb
...@@ -607,6 +607,8 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -607,6 +607,8 @@ int OpenEncoder( vlc_object_t *p_this )
SAMPLE_FMT_S16; SAMPLE_FMT_S16;
p_enc->fmt_in.i_codec = VLC_CODEC_S16N; p_enc->fmt_in.i_codec = VLC_CODEC_S16N;
p_context->sample_rate = p_enc->fmt_out.audio.i_rate; p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
p_context->time_base.num = 1;
p_context->time_base.den = p_context->sample_rate;
p_context->channels = p_enc->fmt_out.audio.i_channels; p_context->channels = p_enc->fmt_out.audio.i_channels;
if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A ) if ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4A )
......
...@@ -382,6 +382,8 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -382,6 +382,8 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
} }
id->ff_enc_c->sample_rate = p_fmt->audio.i_rate; id->ff_enc_c->sample_rate = p_fmt->audio.i_rate;
id->ff_enc_c->time_base.num = 1;
id->ff_enc_c->time_base.den = p_fmt->audio.i_rate;
id->ff_enc_c->channels = p_fmt->audio.i_channels; id->ff_enc_c->channels = p_fmt->audio.i_channels;
id->ff_enc_c->bit_rate = p_fmt->i_bitrate; id->ff_enc_c->bit_rate = p_fmt->i_bitrate;
......
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