]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aacenc.c
lavc: Rewrite VAAPI decode infrastructure
[ffmpeg] / libavcodec / aacenc.c
index 363ed0537b31cf63977affb144c106c4d9e3adb6..956e974cb2abaceec84dd98895bb63fdfa05c880 100644 (file)
@@ -520,13 +520,13 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     int chan_el_counter[4];
     FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
 
-    if (s->last_frame == 2)
-        return 0;
-
     /* add current frame to queue */
     if (frame) {
         if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
             return ret;
+    } else {
+        if (!s->afq.remaining_samples || (!s->afq.frame_alloc && !s->afq.frame_count))
+            return 0;
     }
 
     copy_input_samples(s, frame);
@@ -841,9 +841,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     s->lambda_sum += s->lambda;
     s->lambda_count++;
 
-    if (!frame)
-        s->last_frame++;
-
     ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
                        &avpkt->duration);