From 4ae903d383a19ad65c5ee281b0495ffd577aadf9 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 23 Mar 2022 15:29:55 +0530 Subject: [PATCH] webrtc_sendrecv.py: Link pads instead of elements This was not a problem here because even if we end up accidentally linking to the wrong pad, things will work out eventually as long as one pad-added is emitted for each pad that is added. But it will be a huge problem if someone copies this code and changes something that requires different handling for different sorts of pads. The resultant code will be racy. Let's not do this, it's a bad example. Part-of: --- subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py index 900365db93..6c5442bc2c 100755 --- a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py +++ b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc_sendrecv.py @@ -188,7 +188,7 @@ class WebRTCClient: decodebin.connect('pad-added', self.on_incoming_decodebin_stream) self.pipe.add(decodebin) decodebin.sync_state_with_parent() - self.webrtc.link(decodebin) + pad.link(decodebin.get_static_pad('sink')) def start_pipeline(self, create_offer=True, opus_pt=96, vp8_pt=97): print_status(f'Creating pipeline, create_offer: {create_offer}')