libvorbisenc: fix afq delay setting
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 6 Oct 2012 09:50:38 +0000 (11:50 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Dec 2012 18:36:15 +0000 (19:36 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2c34367b4a17856584b3e8b64cefa1900342ebcd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libvorbisenc.c

index 76a912d..b042e0c 100644 (file)
@@ -362,7 +362,9 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
          * libvorbis, so we have to update the AudioFrameQueue counts */
         if (!avctx->delay) {
             avctx->delay              = duration;
-            s->afq.remaining_delay   += duration;
+            av_assert0(!s->afq.remaining_delay);
+            s->afq.frames->duration  += duration;
+            s->afq.frames->pts       -= duration;
             s->afq.remaining_samples += duration;
         }
         ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration);