qsvenc: set the timestamp for PIX_FMT_QSV frames as well
authorAnton Khirnov <anton@khirnov.net>
Thu, 1 Oct 2015 17:41:56 +0000 (19:41 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 16 Oct 2015 18:00:12 +0000 (20:00 +0200)
libavcodec/qsvenc.c

index 7a57d44..71ac3ce 100644 (file)
@@ -332,10 +332,7 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame,
             return ret;
 
         qf->surface = (mfxFrameSurface1*)qf->frame->data[3];
-        *surface = qf->surface;
-        return 0;
-    }
-
+    } else {
     /* make a copy if the input is not padded as libmfx requires */
     if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) {
         qf->frame->height = FFALIGN(frame->height, 32);
@@ -374,9 +371,11 @@ static int submit_frame(QSVEncContext *q, const AVFrame *frame,
     qf->surface_internal.Data.PitchLow  = qf->frame->linesize[0];
     qf->surface_internal.Data.Y         = qf->frame->data[0];
     qf->surface_internal.Data.UV        = qf->frame->data[1];
-    qf->surface_internal.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000});
 
     qf->surface = &qf->surface_internal;
+    }
+
+    qf->surface->Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000});
 
     *surface = qf->surface;