mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
msdkav1enc: Remove pts workaround
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3225>
This commit is contained in:
parent
2c5a050ae7
commit
78a7c6318a
4 changed files with 3 additions and 45 deletions
|
@ -220,24 +220,6 @@ profile_to_string (gint profile)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_msdkav1enc_set_timestamp (GstMsdkEnc * encoder, mfxU64 timestamp)
|
||||
{
|
||||
GstMsdkAV1Enc *thiz = GST_MSDKAV1ENC (encoder);
|
||||
|
||||
g_queue_push_tail (thiz->timestamp, (gpointer) timestamp);
|
||||
}
|
||||
|
||||
static mfxU64
|
||||
gst_msdkav1enc_get_timestamp (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkAV1Enc *thiz = GST_MSDKAV1ENC (encoder);
|
||||
mfxU64 pts;
|
||||
|
||||
pts = (mfxU64) g_queue_pop_head (thiz->timestamp);
|
||||
return pts;
|
||||
}
|
||||
|
||||
static gint
|
||||
gst_msdkav1enc_find_show_frame (GstMsdkAV1Enc * thiz, guint8 * data, gsize size,
|
||||
gsize * offset)
|
||||
|
@ -320,7 +302,6 @@ gst_msdkav1enc_flush_frames (GstMsdkEnc * encoder)
|
|||
{
|
||||
GstVideoCodecFrame *frame;
|
||||
GstBuffer *out_buf = NULL;
|
||||
mfxU64 pts;
|
||||
|
||||
while (1) {
|
||||
if (!gst_msdkav1enc_pre_finish (encoder, &out_buf, NULL, 0))
|
||||
|
@ -329,8 +310,6 @@ gst_msdkav1enc_flush_frames (GstMsdkEnc * encoder)
|
|||
break;
|
||||
frame = gst_video_encoder_get_oldest_frame (GST_VIDEO_ENCODER (encoder));
|
||||
frame->output_buffer = out_buf;
|
||||
pts = gst_msdkav1enc_get_timestamp (encoder);
|
||||
frame->pts = gst_util_uint64_scale (pts, GST_SECOND, 90000);
|
||||
gst_video_codec_frame_unref (frame);
|
||||
gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (encoder), frame);
|
||||
}
|
||||
|
@ -461,8 +440,6 @@ gst_msdkav1enc_class_init (GstMsdkAV1EncClass * klass)
|
|||
encoder_class->qp_min = 0;
|
||||
encoder_class->pre_finish = gst_msdkav1enc_pre_finish;
|
||||
encoder_class->flush_frames = gst_msdkav1enc_flush_frames;
|
||||
encoder_class->set_timestamp = gst_msdkav1enc_set_timestamp;
|
||||
encoder_class->get_timestamp = gst_msdkav1enc_get_timestamp;
|
||||
|
||||
gst_msdkenc_install_common_properties (encoder_class);
|
||||
|
||||
|
@ -508,5 +485,4 @@ gst_msdkav1enc_init (GstMsdkAV1Enc * thiz)
|
|||
thiz->p_pyramid = PROP_P_PYRAMID_DEFAULT;
|
||||
thiz->adapter = gst_adapter_new ();
|
||||
thiz->parser = gst_av1_parser_new ();
|
||||
thiz->timestamp = g_queue_new ();
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ struct _GstMsdkAV1Enc
|
|||
|
||||
GstAdapter *adapter;
|
||||
GstAV1Parser *parser;
|
||||
GQueue *timestamp;
|
||||
};
|
||||
|
||||
struct _GstMsdkAV1EncClass
|
||||
|
|
|
@ -1070,7 +1070,6 @@ gst_msdkenc_finish_frame (GstMsdkEnc * thiz, MsdkEncTask * task,
|
|||
GstMsdkEncClass *klass = GST_MSDKENC_GET_CLASS (thiz);
|
||||
GstVideoCodecFrame *frame;
|
||||
GList *list;
|
||||
mfxU64 pts;
|
||||
|
||||
if (!task->sync_point)
|
||||
return GST_FLOW_OK;
|
||||
|
@ -1116,18 +1115,9 @@ gst_msdkenc_finish_frame (GstMsdkEnc * thiz, MsdkEncTask * task,
|
|||
}
|
||||
|
||||
frame->output_buffer = out_buf;
|
||||
/* This is a workaround for output pts, because oneVPL cannot return the
|
||||
* correct pts for each display frame. We just use the input frame's pts
|
||||
* as output ones as oneVPL return each coded frames as display.
|
||||
*/
|
||||
if (klass->get_timestamp) {
|
||||
pts = klass->get_timestamp (thiz);
|
||||
frame->pts = gst_util_uint64_scale (pts, GST_SECOND, 90000);
|
||||
} else {
|
||||
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);
|
||||
|
@ -1775,9 +1765,6 @@ gst_msdkenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
|
|||
if (frame->pts != GST_CLOCK_TIME_NONE) {
|
||||
surface->surface->Data.TimeStamp =
|
||||
gst_util_uint64_scale (frame->pts, 90000, GST_SECOND);
|
||||
|
||||
if (klass->set_timestamp)
|
||||
klass->set_timestamp (thiz, surface->surface->Data.TimeStamp);
|
||||
} else {
|
||||
surface->surface->Data.TimeStamp = MFX_TIMESTAMP_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -198,10 +198,6 @@ struct _GstMsdkEncClass
|
|||
guint8 *data, gsize size);
|
||||
void (*flush_frames) (GstMsdkEnc * encoder);
|
||||
|
||||
void (*set_timestamp) (GstMsdkEnc * encoder, mfxU64 pts);
|
||||
|
||||
mfxU64 (*get_timestamp) (GstMsdkEnc * encoder);
|
||||
|
||||
guint qp_max;
|
||||
guint qp_min;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue