gst/src: Check for 0 framerate before setting duration

This is possible if the source doesn't provide the framerate (as is the
case for libcamera), or if the framerate is variable (0/1).
This commit is contained in:
Arun Raghavan 2024-05-28 13:45:58 +03:00
parent 169e5ecd4b
commit 1e3797512a

View file

@ -605,8 +605,10 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc)
} }
if (pwsrc->is_video) { if (pwsrc->is_video) {
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND, if (pwsrc->video_info.fps_n) {
pwsrc->video_info.fps_d, pwsrc->video_info.fps_n); GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
pwsrc->video_info.fps_d, pwsrc->video_info.fps_n);
}
} else { } else {
GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND, GST_BUFFER_DURATION (buf) = gst_util_uint64_scale (GST_SECOND,
time.size * time.rate.num, time.rate.denom); time.size * time.rate.num, time.rate.denom);