]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libopusenc.c
avcodec/mjpegenc: Fix segfault when freeing incomplete context
[ffmpeg] / libavcodec / libopusenc.c
index bf2d04b4fb03628a5fee75d81a87611791c34d9d..70d17f802bdc6e4e47d33e11268a07157d1db59c 100644 (file)
@@ -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. */