mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/libopusenc: Fix for header pre-skip value
The Opus header initial padding preskip amount is always to be expressed relative to 48kHz. However, the encoder delay returned from querying libopus is relative to the encoding samplerate. Multiply by the samplerate conversion factor to correct. Signed-off-by: Arthur Taylor <art@ified.ca>
This commit is contained in:
parent
66deab3a26
commit
f4bdeddc3c
@ -94,7 +94,7 @@ static void libopus_write_header(AVCodecContext *avctx, int stream_count,
|
||||
bytestream_put_buffer(&p, "OpusHead", 8);
|
||||
bytestream_put_byte(&p, 1); /* Version */
|
||||
bytestream_put_byte(&p, channels);
|
||||
bytestream_put_le16(&p, avctx->initial_padding); /* Lookahead samples at 48kHz */
|
||||
bytestream_put_le16(&p, avctx->initial_padding * 48000 / avctx->sample_rate); /* Lookahead samples at 48kHz */
|
||||
bytestream_put_le32(&p, avctx->sample_rate); /* Original sample rate */
|
||||
bytestream_put_le16(&p, 0); /* Gain of 0dB is recommended. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user