aboutsummaryrefslogtreecommitdiff
path: root/plugins/rtp/src/plugin.vala
diff options
context:
space:
mode:
authorMatthew Egeler <wentam42@gmail.com>2022-05-17 08:12:32 -0400
committerGitHub <noreply@github.com>2022-05-17 14:12:32 +0200
commitf25bfb00969a7e09996da2d5500e6718f4cc0148 (patch)
tree1fef2acd52e4403bc3752f4c0b5851e6a43ee8f8 /plugins/rtp/src/plugin.vala
parent186361fd8a381ef3c3334683dfb9cc4de1417596 (diff)
downloaddino-f25bfb00969a7e09996da2d5500e6718f4cc0148.tar.gz
dino-f25bfb00969a7e09996da2d5500e6718f4cc0148.zip
Support devices with multiple framerate options in get_max_fps (#1224)
Diffstat (limited to 'plugins/rtp/src/plugin.vala')
-rw-r--r--plugins/rtp/src/plugin.vala22
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/rtp/src/plugin.vala b/plugins/rtp/src/plugin.vala
index 3a4f6ce1..dc446530 100644
--- a/plugins/rtp/src/plugin.vala
+++ b/plugins/rtp/src/plugin.vala
@@ -382,9 +382,27 @@ public class Dino.Plugins.Rtp.Plugin : RootInterface, VideoCallPlugin, Object {
int fps = 0;
for (int i = 0; i < device.device.caps.get_size(); i++) {
unowned Gst.Structure structure = device.device.caps.get_structure(i);
- int num = 0, den = 0;
- if (structure.has_field("framerate") && structure.get_fraction("framerate", out num, out den)) fps = int.max(fps, num / den);
+
+ if (structure.has_field("framerate")) {
+ Value framerate = structure.get_value("framerate");
+ if (framerate.type() == typeof(Gst.Fraction)) {
+ int num = Gst.Value.get_fraction_numerator(framerate);
+ int den = Gst.Value.get_fraction_denominator(framerate);
+ fps = int.max(fps, num / den);
+ } else if (framerate.type() == typeof(Gst.ValueList)) {
+ for(uint j = 0; j < Gst.ValueList.get_size(framerate); j++) {
+ Value fraction = Gst.ValueList.get_value(framerate, j);
+ int num = Gst.Value.get_fraction_numerator(fraction);
+ int den = Gst.Value.get_fraction_denominator(fraction);
+ fps = int.max(fps, num / den);
+ }
+ } else {
+ debug("Unknown type for framerate %s on device %s", framerate.type_name(), device.display_name);
+ }
+ }
}
+
+ debug("Max framerate for device %s: %d", device.display_name, fps);
return fps;
}