Commit d283ee08 authored by Paul B Mahol's avatar Paul B Mahol

avcodec/g723_1dec: improve stereo support

parent 7a124138
......@@ -43,7 +43,6 @@
static av_cold int g723_1_decode_init(AVCodecContext *avctx)
{
G723_1_Context *s = avctx->priv_data;
G723_1_ChannelContext *p = &s->ch[0];
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
if (avctx->channels < 1 || avctx->channels > 2) {
......@@ -51,6 +50,9 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
for (int ch = 0; ch < avctx->channels; ch++) {
G723_1_ChannelContext *p = &s->ch[ch];
p->pf_gain = 1 << 12;
memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp));
......@@ -58,6 +60,7 @@ static av_cold int g723_1_decode_init(AVCodecContext *avctx)
p->cng_random_seed = CNG_RANDOM_SEED;
p->past_frame_type = SID_FRAME;
}
return 0;
}
......
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