gstsmartencoder: don't make calculations for invalid DTS

Instead, as the current code relies on having a valid DTS (for lining
up passed through and re-encoded segments), simply compute a DTS
from the PTS if the DTS was invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1549>
This commit is contained in:
Mathieu Duponchelle 2022-01-21 01:02:52 +01:00 committed by GStreamer Marge Bot
parent 62c303c2e0
commit b2c4052531

View file

@ -91,9 +91,12 @@ translate_timestamp_from_internal_to_src (GstSmartEncoder * self,
static GstFlowReturn static GstFlowReturn
gst_smart_encoder_finish_buffer (GstSmartEncoder * self, GstBuffer * buf) gst_smart_encoder_finish_buffer (GstSmartEncoder * self, GstBuffer * buf)
{ {
if (!GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buf)))
GST_BUFFER_DTS (buf) = GST_BUFFER_PTS (buf);
translate_timestamp_from_internal_to_src (self, &GST_BUFFER_PTS (buf)); translate_timestamp_from_internal_to_src (self, &GST_BUFFER_PTS (buf));
translate_timestamp_from_internal_to_src (self, &GST_BUFFER_DTS (buf)); translate_timestamp_from_internal_to_src (self, &GST_BUFFER_DTS (buf));
GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (buf);
if (self->last_dts > GST_BUFFER_DTS (buf)) { if (self->last_dts > GST_BUFFER_DTS (buf)) {
/* Hack to always produces dts increasing DTS-s that are close to what the /* Hack to always produces dts increasing DTS-s that are close to what the
* encoder produced. */ * encoder produced. */