mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 09:12:19 +00:00
rpicamsrc: Set outgoing buffer durations based on negotiated framerate.
make sure outgoing buffers have at least some duration set, otherwise it leads to strange situations, like qtmux writing out a file that doesn't include the final frame inside the playable segment, because no-duration = 0 duration there.
This commit is contained in:
parent
dd9d7341b0
commit
1670712500
2 changed files with 12 additions and 1 deletions
|
@ -1342,6 +1342,13 @@ gst_rpi_cam_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
|
||||||
src->capture_config.height = info.height;
|
src->capture_config.height = info.height;
|
||||||
src->capture_config.fps_n = info.fps_n;
|
src->capture_config.fps_n = info.fps_n;
|
||||||
src->capture_config.fps_d = info.fps_d;
|
src->capture_config.fps_d = info.fps_d;
|
||||||
|
|
||||||
|
if (info.fps_n != 0 && info.fps_d != 0)
|
||||||
|
src->duration = gst_util_uint64_scale_int (GST_SECOND, info.fps_d,
|
||||||
|
info.fps_n);
|
||||||
|
else
|
||||||
|
src->duration = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1407,9 +1414,11 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
|
||||||
|
|
||||||
/* FIXME: Use custom allocator */
|
/* FIXME: Use custom allocator */
|
||||||
ret = raspi_capture_fill_buffer (src->capture_state, buf, clock, base_time);
|
ret = raspi_capture_fill_buffer (src->capture_state, buf, clock, base_time);
|
||||||
if (*buf)
|
if (*buf) {
|
||||||
GST_LOG_OBJECT (src, "Made buffer of size %" G_GSIZE_FORMAT,
|
GST_LOG_OBJECT (src, "Made buffer of size %" G_GSIZE_FORMAT,
|
||||||
gst_buffer_get_size (*buf));
|
gst_buffer_get_size (*buf));
|
||||||
|
GST_BUFFER_DURATION (*buf) = src->duration;
|
||||||
|
}
|
||||||
|
|
||||||
if (clock)
|
if (clock)
|
||||||
gst_object_unref (clock);
|
gst_object_unref (clock);
|
||||||
|
|
|
@ -86,6 +86,8 @@ struct _GstRpiCamSrc
|
||||||
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
|
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
|
||||||
GstVideoOrientationMethod orientation;
|
GstVideoOrientationMethod orientation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GstClockTime duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRpiCamSrcClass
|
struct _GstRpiCamSrcClass
|
||||||
|
|
Loading…
Reference in a new issue