diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e7fdae2ef8..6adc11f83c 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -1277,8 +1277,6 @@ static av_cold int validate_options(AVCodecContext *avctx, AC3EncodeContext *s) s->sample_rate = avctx->sample_rate; s->bit_alloc.sr_shift = i % 3; s->bit_alloc.sr_code = i / 3; - s->bitstream_id = 8 + s->bit_alloc.sr_shift; - s->bitstream_mode = 0; /* complete main audio service */ /* bitrate & frame size */ for (i = 0; i < 19; i++) { @@ -1312,6 +1310,9 @@ static av_cold int ac3_encode_init(AVCodecContext *avctx) if (ret) return ret; + s->bitstream_id = 8 + s->bit_alloc.sr_shift; + s->bitstream_mode = 0; /* complete main audio service */ + s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code]; s->bits_written = 0; s->samples_written = 0;