diff --git a/libervia/frontends/tools/webrtc.py b/libervia/frontends/tools/webrtc.py index 6787c65c..0097ff80 100644 --- a/libervia/frontends/tools/webrtc.py +++ b/libervia/frontends/tools/webrtc.py @@ -1024,9 +1024,12 @@ class WebRTC: ) # Check and log the original size of the video - width = self.target_width - height = self.target_height + structure = caps.get_structure(0) + width = structure.get_int('width')[1] if structure.has_field('width') else self.target_width + height = structure.get_int('height')[1] if structure.has_field('height') else self.target_height + log.debug(f"Original video size: {width}x{height}") + log.debug(f"Target size: {self.target_width}x{self.target_height}") # This is a fix for an issue found with Movim on desktop: a non standard # resolution is used (990x557) resulting in bad alignement and no color in @@ -1048,14 +1051,14 @@ class WebRTC: sink1_pad = compositor.get_static_pad("sink_1") local_width, local_height = self.scaled_dimensions( - sink1_pad.get_property("width"), - sink1_pad.get_property("height"), + self.target_width, + self.target_height, width // 3, height // 3, ) - sink1_pad.set_property("xpos", width - local_width) - sink1_pad.set_property("ypos", height - local_height) + sink1_pad.set_property("xpos", self.target_width - local_width) + sink1_pad.set_property("ypos", self.target_height - local_height) sink1_pad.set_property("width", local_width) sink1_pad.set_property("height", local_height) sink1_pad.set_property("sizing-policy", 1) @@ -1065,8 +1068,8 @@ class WebRTC: sink_pad_template = compositor.get_pad_template("sink_%u") remote_video_sink = compositor.request_pad(sink_pad_template, None, None) remote_video_sink.set_property("zorder", 0) - remote_video_sink.set_property("width", width) - remote_video_sink.set_property("height", height) + remote_video_sink.set_property("width", self.target_width) + remote_video_sink.set_property("height", self.target_height) remote_video_sink.set_property("sizing-policy", 1) elif isinstance(self.sinks_data, SinksApp):