mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
libspeex: allow custom sample rates again.
This was broken by 3b061c5e10
Fixes trac issue #1974.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
03290ffb57
commit
e2fc6a01f6
@ -51,6 +51,7 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
|
|||||||
av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
|
av_log(avctx, AV_LOG_WARNING, "Invalid Speex header\n");
|
||||||
}
|
}
|
||||||
if (header) {
|
if (header) {
|
||||||
|
avctx->sample_rate = header->rate;
|
||||||
avctx->channels = header->nb_channels;
|
avctx->channels = header->nb_channels;
|
||||||
spx_mode = header->mode;
|
spx_mode = header->mode;
|
||||||
speex_header_free(header);
|
speex_header_free(header);
|
||||||
@ -73,8 +74,9 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
|
|||||||
av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", spx_mode);
|
av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", spx_mode);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
avctx->sample_rate = 8000 << spx_mode;
|
|
||||||
s->frame_size = 160 << spx_mode;
|
s->frame_size = 160 << spx_mode;
|
||||||
|
if (!avctx->sample_rate)
|
||||||
|
avctx->sample_rate = 8000 << 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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user