BugFix Repair Linux loopback on vl42

This commit is contained in:
brunoherbelin
2026-03-04 18:27:17 +01:00
parent 948624ec5d
commit 70bf03b026
+13 -12
View File
@@ -83,6 +83,17 @@ std::string Loopback::init(GstCaps *read_caps, GstCaps *write_caps)
if (read_caps == nullptr || write_caps == nullptr)
return std::string("Loopback : Invalid caps");
// specify streaming framerate in the given reading caps
read_caps_ = gst_caps_copy( read_caps );
GValue v = G_VALUE_INIT;
g_value_init (&v, GST_TYPE_FRACTION);
gst_value_set_fraction (&v, LOOPBACK_FPS, 1); // fixed 30 FPS
gst_caps_set_value(read_caps_, "framerate", &v);
g_value_unset (&v);
// set write caps
write_caps_ = gst_caps_copy( write_caps );
// create a gstreamer pipeline
std::string description = "appsrc name=src ! videoconvert ! videoscale ! capsfilter name=capf ! queue ! ";
@@ -107,7 +118,7 @@ std::string Loopback::init(GstCaps *read_caps, GstCaps *write_caps)
// setup capsfilter for scaling to write_caps
GstElement *capsfilter = gst_bin_get_by_name (GST_BIN (pipeline_), "capf");
if (capsfilter) {
g_object_set (G_OBJECT (capsfilter), "caps", write_caps, NULL);
g_object_set (G_OBJECT (capsfilter), "caps", write_caps_, NULL);
gst_object_unref (capsfilter);
}
@@ -127,18 +138,8 @@ std::string Loopback::init(GstCaps *read_caps, GstCaps *write_caps)
// Set buffer size
gst_app_src_set_max_bytes( src_, buffering_size_ );
// specify streaming framerate in the given caps
GstCaps *tmp = gst_caps_copy( read_caps );
GValue v = G_VALUE_INIT;
g_value_init (&v, GST_TYPE_FRACTION);
gst_value_set_fraction (&v, LOOPBACK_FPS, 1); // fixed FPS
gst_caps_set_value(tmp, "framerate", &v);
g_value_unset (&v);
// instruct src to use the caps
read_caps = gst_caps_copy( tmp );
gst_app_src_set_caps (src_, read_caps);
gst_caps_unref (tmp);
gst_app_src_set_caps (src_, read_caps_);
// setup callbacks
GstAppSrcCallbacks callbacks;