Fix build with older Vala compilers

- Older versions seem to assume a wrong type for Nice messages
- Older versions have broken bindings for Gst.Value.set_fraction
This commit is contained in:
Marvin W 2021-12-23 06:39:18 +01:00
parent d02c5bc55d
commit 1c47652814
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
2 changed files with 13 additions and 2 deletions

View file

@ -45,11 +45,13 @@ public class Dino.Plugins.Ice.TransportParameters : JingleIceUdp.IceUdpTransport
if (encrypted_data == null) return; if (encrypted_data == null) return;
// TODO: Nonblocking might require certain libnice versions? // TODO: Nonblocking might require certain libnice versions?
GLib.OutputVector[] vectors = {{ encrypted_data, encrypted_data.length }}; GLib.OutputVector[] vectors = {{ encrypted_data, encrypted_data.length }};
Nice.OutputMessage[] messages = {{ vectors }}; Nice.OutputMessage message = { vectors };
Nice.OutputMessage[] messages = { message };
agent.send_messages_nonblocking(stream_id, component_id, messages); agent.send_messages_nonblocking(stream_id, component_id, messages);
} else { } else {
GLib.OutputVector[] vectors = {{ datagram.get_data(), datagram.get_size() }}; GLib.OutputVector[] vectors = {{ datagram.get_data(), datagram.get_size() }};
Nice.OutputMessage[] messages = {{ vectors }}; Nice.OutputMessage message = { vectors };
Nice.OutputMessage[] messages = { message };
agent.send_messages_nonblocking(stream_id, component_id, messages); agent.send_messages_nonblocking(stream_id, component_id, messages);
} }
bytes_sent += datagram.length; bytes_sent += datagram.length;

View file

@ -1,3 +1,8 @@
#if !VALA_0_52
[CCode (cheader_filename = "gst/gst.h")]
private static extern void gst_value_set_fraction(ref GLib.Value value, int numerator, int denominator);
#endif
public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidget { public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidget {
private static uint last_id = 0; private static uint last_id = 0;
@ -50,7 +55,11 @@ public class Dino.Plugins.Rtp.VideoWidget : Gtk.Bin, Dino.Plugins.VideoCallWidge
Gst.Element crop = ((Gst.Bin)prepare).get_by_name(@"video_widget_$(id)_crop"); Gst.Element crop = ((Gst.Bin)prepare).get_by_name(@"video_widget_$(id)_crop");
if (crop != null) { if (crop != null) {
Value ratio = new Value(typeof(Gst.Fraction)); Value ratio = new Value(typeof(Gst.Fraction));
#if VALA_0_52
Gst.Value.set_fraction(ref ratio, allocation.width, allocation.height); Gst.Value.set_fraction(ref ratio, allocation.width, allocation.height);
#else
gst_value_set_fraction(ref ratio, allocation.width, allocation.height);
#endif
crop.set_property("aspect-ratio", ratio); crop.set_property("aspect-ratio", ratio);
} }
} }