gst/src: Set buffer duration

We compute this from the clock quantum for audio and the negotiated
framerate for video.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1438
This commit is contained in:
Arun Raghavan 2024-05-27 14:26:36 +03:00 committed by Wim Taymans
parent 2f9a5e0694
commit 3cc5ca5a91

View file

@ -603,6 +603,15 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
GST_BUFFER_PTS (buf) = b->time - pwsrc->delay;
GST_BUFFER_DTS (buf) = b->time - pwsrc->delay;
}
if (pwsrc->is_video) {
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
pwsrc->video_info.fps_d, pwsrc->video_info.fps_n);
} else {
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
time.size * time.rate.num, time.rate.denom);
}
crop = data->crop;
if (crop) {
GstVideoCropMeta *meta = gst_buffer_get_video_crop_meta(buf);