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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2008>
This commit is contained in:
Nirbheek Chauhan 2022-03-23 15:29:55 +05:30 committed by GStreamer Marge Bot
parent 1403e74196
commit 4ae903d383

View file

@ -188,7 +188,7 @@ class WebRTCClient:
decodebin.connect('pad-added', self.on_incoming_decodebin_stream) decodebin.connect('pad-added', self.on_incoming_decodebin_stream)
self.pipe.add(decodebin) self.pipe.add(decodebin)
decodebin.sync_state_with_parent() 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): def start_pipeline(self, create_offer=True, opus_pt=96, vp8_pt=97):
print_status(f'Creating pipeline, create_offer: {create_offer}') print_status(f'Creating pipeline, create_offer: {create_offer}')