From 3b3e862580f4668f23edff0bd441fbec7f138cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 11 Jan 2023 15:04:07 +0200 Subject: [PATCH] gstreamer: Don't set a DTS and remove non-working DTS hack The previous hack would create bogus DTS that confused other elements. Fixes https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/1915 --- .../gst-plugins-bad/ext/svtav1/gstsvtav1enc.c | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c b/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c index 595fbf1708..233b96e0be 100644 --- a/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c +++ b/subprojects/gst-plugins-bad/ext/svtav1/gstsvtav1enc.c @@ -298,7 +298,6 @@ gst_svtav1enc_init (GstSvtAv1Enc * svtav1enc) } memset (&svtav1enc->svt_encoder, 0, sizeof (svtav1enc->svt_encoder)); svtav1enc->frame_count = 0; - svtav1enc->dts_offset = 0; EbErrorType res = svt_av1_enc_init_handle(&svtav1enc->svt_encoder, NULL, svtav1enc->svt_config); @@ -682,29 +681,11 @@ gst_svtav1enc_dequeue_encoded_frames (GstSvtAv1Enc * svtav1enc, gst_buffer_fill (frame->output_buffer, 0, output_buf->p_buffer, output_buf->n_filled_len); - - /* SVT-AV1 may return first frames with a negative DTS, - * offsetting it to start at 0 since GStreamer 1.x doesn't support it */ - if (output_buf->dts + svtav1enc->dts_offset < 0) { - svtav1enc->dts_offset = -output_buf->dts; - } - /* Gstreamer doesn't support negative DTS so we return - * very small increasing ones for the first frames. */ - if (output_buf->dts < 1) { - frame->dts = frame->output_buffer->dts = - output_buf->dts + svtav1enc->dts_offset; - } else { - frame->dts = frame->output_buffer->dts = - (output_buf->dts * - svtav1enc->svt_config->frame_rate_denominator * GST_SECOND) / - svtav1enc->svt_config->frame_rate_numerator; - } - frame->pts = frame->output_buffer->pts = output_buf->pts; - GST_LOG_OBJECT (svtav1enc, "#frame:%lld dts:%" G_GINT64_FORMAT " pts:%" + GST_LOG_OBJECT (svtav1enc, "#frame:%lld pts:%" G_GINT64_FORMAT " SliceType:%d\n", svtav1enc->frame_count, - (frame->dts), (frame->pts), output_buf->pic_type); + (frame->pts), output_buf->pic_type); svt_av1_enc_release_out_buffer(&output_buf); output_buf = NULL;