Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2016-10-08 14:12:09 +0300
committerTim-Philipp Müller <tim@centricular.com>2020-07-10 18:45:53 +0300
commit16707125004d50761d4afa41a513b3d0b2ef83f2 (patch)
treef99fc190f150c3ea532a9afac52ad8650112f9b8 /sys
parentdd9d7341b0f8120d9bb3862d195a95b5b0834ae2 (diff)
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/rpicamsrc/gstrpicamsrc.c11
-rw-r--r--sys/rpicamsrc/gstrpicamsrc.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/sys/rpicamsrc/gstrpicamsrc.c b/sys/rpicamsrc/gstrpicamsrc.c
index a9cf7cd89..8712c21c2 100644
--- a/sys/rpicamsrc/gstrpicamsrc.c
+++ b/sys/rpicamsrc/gstrpicamsrc.c
@@ -1342,6 +1342,13 @@ gst_rpi_cam_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
src->capture_config.height = info.height;
src->capture_config.fps_n = info.fps_n;
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;
}
@@ -1407,9 +1414,11 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
/* FIXME: Use custom allocator */
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_buffer_get_size (*buf));
+ GST_BUFFER_DURATION (*buf) = src->duration;
+ }
if (clock)
gst_object_unref (clock);
diff --git a/sys/rpicamsrc/gstrpicamsrc.h b/sys/rpicamsrc/gstrpicamsrc.h
index 6675f8804..68fdc1829 100644
--- a/sys/rpicamsrc/gstrpicamsrc.h
+++ b/sys/rpicamsrc/gstrpicamsrc.h
@@ -86,6 +86,8 @@ struct _GstRpiCamSrc
#ifdef GST_RPI_CAM_SRC_ENABLE_VIDEO_DIRECTION
GstVideoOrientationMethod orientation;
#endif
+
+ GstClockTime duration;
};
struct _GstRpiCamSrcClass