From fe160d94ba8a08a806dc755d918dc3de0a645d7c Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 11 Apr 2021 15:57:53 +0200 Subject: Handle broken VAPI in older vala --- plugins/rtp/src/stream.vala | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/rtp/src/stream.vala b/plugins/rtp/src/stream.vala index efa1b497..3a63f3fa 100644 --- a/plugins/rtp/src/stream.vala +++ b/plugins/rtp/src/stream.vala @@ -300,7 +300,17 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { } } if (push_recv_data) { - recv_rtp.push_buffer(new Gst.Buffer.wrapped((owned) data)); + Gst.Buffer buffer = new Gst.Buffer.wrapped((owned) data); + // FIXME: VAPI file in Vala < 0.49.1 has a bug that results in broken ownership of buffer in push_buffer() + // We workaround by using the plain signal. The signal unfortunately will cause an unnecessary copy of + // the underlying buffer, so and some point we should move over to the new version (once we require + // Vala >= 0.50) +#if FIXED_APPSRC_PUSH_BUFFER_IN_VAPI + recv_rtp.push_buffer((owned) buffer); +#else + Gst.FlowReturn ret; + GLib.Signal.emit_by_name(recv_rtp, "push-buffer", buffer, out ret); +#endif } } @@ -315,7 +325,14 @@ public class Dino.Plugins.Rtp.Stream : Xmpp.Xep.JingleRtp.Stream { } } if (push_recv_data) { - recv_rtcp.push_buffer(new Gst.Buffer.wrapped((owned) data)); + Gst.Buffer buffer = new Gst.Buffer.wrapped((owned) data); + // See above +#if FIXED_APPSRC_PUSH_BUFFER_IN_VAPI + recv_rtcp.push_buffer((owned) buffer); +#else + Gst.FlowReturn ret; + GLib.Signal.emit_by_name(recv_rtcp, "push-buffer", buffer, out ret); +#endif } } -- cgit v1.2.3-70-g09d2