Revert "pipewiresrc: Use clock time difference to update last_buffer time"

This reverts commit efd1526423.
This commit is contained in:
Stefan Klug 2026-04-14 16:01:27 +02:00
parent 43b19e7668
commit 1b4de00654
2 changed files with 6 additions and 29 deletions

View file

@ -531,7 +531,6 @@ gst_pipewire_src_init (GstPipeWireSrc * src)
src->autoconnect = DEFAULT_AUTOCONNECT;
src->min_latency = 0;
src->max_latency = GST_CLOCK_TIME_NONE;
src->last_buffer_clock_time = GST_CLOCK_TIME_NONE;
src->n_buffers = 0;
src->flushing_on_remove_buffer = FALSE;
src->on_disconnect = DEFAULT_ON_DISCONNECT;
@ -1615,21 +1614,12 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
GST_LOG_OBJECT (pwsrc, "popped buffer %p", buf);
if (buf != NULL) {
if (pwsrc->resend_last || pwsrc->keepalive_time > 0) {
GstClock *clock;
GstBuffer *old;
old = pwsrc->last_buffer;
pwsrc->last_buffer = gst_buffer_copy (buf);
gst_buffer_unref (old);
gst_buffer_add_parent_buffer_meta (pwsrc->last_buffer, buf);
clock = gst_element_get_clock (GST_ELEMENT_CAST (pwsrc));
if (clock != NULL) {
pwsrc->last_buffer_clock_time = gst_clock_get_time (clock);
gst_object_unref (clock);
} else {
pwsrc->last_buffer_clock_time = GST_CLOCK_TIME_NONE;
}
}
break;
}
@ -1655,33 +1645,21 @@ gst_pipewire_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
if (update_time) {
GstClock *clock;
GstClockTime current_clock_time;
GstClockTime pts, dts;
clock = gst_element_get_clock (GST_ELEMENT_CAST (pwsrc));
if (clock != NULL) {
current_clock_time = gst_clock_get_time (clock);
pts = dts = gst_clock_get_time (clock);
gst_object_unref (clock);
} else {
current_clock_time = GST_CLOCK_TIME_NONE;
pts = dts = GST_CLOCK_TIME_NONE;
}
if (GST_CLOCK_TIME_IS_VALID (current_clock_time) &&
GST_CLOCK_TIME_IS_VALID (pwsrc->last_buffer_clock_time) &&
GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (*buffer)) &&
GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (*buffer))) {
GstClockTime diff;
diff = current_clock_time - pwsrc->last_buffer_clock_time;
GST_BUFFER_PTS (*buffer) += diff;
GST_BUFFER_DTS (*buffer) += diff;
} else {
GST_BUFFER_PTS (*buffer) = GST_BUFFER_DTS (*buffer) = current_clock_time;
}
GST_BUFFER_PTS (*buffer) = pts;
GST_BUFFER_DTS (*buffer) = dts;
GST_LOG_OBJECT (pwsrc, "Sending keepalive buffer pts/dts: %" GST_TIME_FORMAT
" (%" G_GUINT64_FORMAT ")", GST_TIME_ARGS (current_clock_time),
current_clock_time);
" (%" G_GUINT64_FORMAT ")", GST_TIME_ARGS (pts), pts);
}
return GST_FLOW_OK;

View file

@ -83,7 +83,6 @@ struct _GstPipeWireSrc {
GstClockTime max_latency;
GstBuffer *last_buffer;
GstClockTime last_buffer_clock_time;
enum spa_meta_videotransform_value transform_value;