Commit 892695c8 authored by Justin Ruggles's avatar Justin Ruggles

libspeexdec: simplify setting of frame_size

parent 27c3f9c0
...@@ -49,7 +49,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) ...@@ -49,7 +49,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_fmt = AV_SAMPLE_FMT_S16;
if (s->header) { if (s->header) {
avctx->channels = s->header->nb_channels; avctx->channels = s->header->nb_channels;
s->frame_size = s->header->frame_size;
spx_mode = s->header->mode; spx_mode = s->header->mode;
} else { } else {
switch (avctx->sample_rate) { switch (avctx->sample_rate) {
...@@ -71,6 +70,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) ...@@ -71,6 +70,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
avctx->sample_rate = 8000 << spx_mode; avctx->sample_rate = 8000 << spx_mode;
s->frame_size = 160 << spx_mode;
if (avctx->channels < 1 || avctx->channels > 2) { if (avctx->channels < 1 || avctx->channels > 2) {
/* libspeex can handle mono or stereo if initialized as stereo */ /* libspeex can handle mono or stereo if initialized as stereo */
...@@ -88,10 +88,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx) ...@@ -88,10 +88,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
return -1; return -1;
} }
if (!s->header) {
speex_decoder_ctl(s->dec_state, SPEEX_GET_FRAME_SIZE, &s->frame_size);
}
if (avctx->channels == 2) { if (avctx->channels == 2) {
SpeexCallback callback; SpeexCallback callback;
callback.callback_id = SPEEX_INBAND_STEREO; callback.callback_id = SPEEX_INBAND_STEREO;
......
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