summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott D Phillips <scott.d.phillips@intel.com>2017-05-18 10:36:50 -0700
committerSebastian Dröge <sebastian@centricular.com>2017-06-12 10:00:56 +0300
commit0c924efebf0d98fb1a274ddbc8faa473fb7e7fc8 (patch)
treeeff0896105292247e4e22921099672cfea441a2f
parent5801d0b47162f6609ffff3b6b5bb625ea7e144d7 (diff)
downloadgstreamer-plugins-bad-0c924efebf0d98fb1a274ddbc8faa473fb7e7fc8.tar.gz
msdk: enc: set pts and dts, fix inverted sync_point flag
Set the pts and dts on the frame that we receive from the msdk. Also fix the inverted logic in setting sync points, previously we were marking all frames as sync points except IDRs. https://bugzilla.gnome.org/show_bug.cgi?id=782801
-rw-r--r--sys/msdk/gstmsdkenc.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/msdk/gstmsdkenc.c b/sys/msdk/gstmsdkenc.c
index 435cbc534..933eaf950 100644
--- a/sys/msdk/gstmsdkenc.c
+++ b/sys/msdk/gstmsdkenc.c
@@ -466,8 +466,15 @@ gst_msdkenc_finish_frame (GstMsdkEnc * thiz, MsdkEncTask * task,
out_buf = gst_buffer_new_allocate (NULL, size, NULL);
gst_buffer_fill (out_buf, 0, data, size);
frame->output_buffer = out_buf;
- if ((task->output_bitstream.FrameType & MFX_FRAMETYPE_IDR) == 0 &&
- (task->output_bitstream.FrameType & MFX_FRAMETYPE_xIDR) == 0) {
+ frame->pts =
+ gst_util_uint64_scale (task->output_bitstream.TimeStamp, GST_SECOND,
+ 90000);
+ frame->dts =
+ gst_util_uint64_scale (task->output_bitstream.DecodeTimeStamp,
+ GST_SECOND, 90000);
+
+ if ((task->output_bitstream.FrameType & MFX_FRAMETYPE_IDR) != 0 ||
+ (task->output_bitstream.FrameType & MFX_FRAMETYPE_xIDR) != 0) {
GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
}
@@ -686,6 +693,11 @@ invalid_frame:
static gboolean
gst_msdkenc_start (GstVideoEncoder * encoder)
{
+ /* Set the minimum pts to some huge value (1000 hours). This keeps
+ the dts at the start of the stream from needing to be
+ negative. */
+ gst_video_encoder_set_min_pts (encoder, GST_SECOND * 60 * 60 * 1000);
+
return TRUE;
}