webrtcbin: GStreamer-CRITICAL (padname not unique) with enabled both ULP_FEC and RTX using iOS devices
Submitted by Szymon Piechaczek
Link to original bug (#797328)
Description
I'm using webrtcbin as sendrecv endpoint (H264 video and Opus audio) with iOS devices (native WebRTC SDK) and I've been facing many video issues over wireless networks (dropped keyframes etc.).
I enabled FEC and RTX on webrtcbin with this Python code:
def _on_new_transceiver(self, element, transceiver):
if transceiver.mline == 1:
transceiver.set_property("fec-type", GstWebRTC.WebRTCFECType.ULP_RED)
transceiver.set_property("do-nack", True)
The problem is that enabling both of them makes webrtcbin to double-create "src_1" pad:
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.072505020 212 0x7f4df0095050 DEBUG webrtcbin gstwebrtcbin.c:3369:on_rtpbin_request_pt_map:<webrtcbin0>
getting pt map for pt 99 in session 1
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.073430701 212 0x7f4df0095050 INFO rtpjitterbuffer rtpjitterbuffer.c:778:rtp_jitter_buffer_calculate_pts: resync to time 0:00:07.084805979, rtptime 8:16:32.042122222
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.073458015 212 0x7f4dac003c50 INFO rtpjitterbuffer gstrtpjitterbuffer.c:3942:do_deadline_timeout:<rtpjitterbuffer2>
got deadline timeout
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.073584023 212 0x7f4df02a21e0 DEBUG webrtcbin gstwebrtcbin.c:3562:on_rtpbin_request_fec_decoder:<webrtcbin0>
Creating ULPFEC decoder for pt 97 in session 1
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.074065056 212 0x7f4df02a21e0 DEBUG webrtcbin gstwebrtcbin.c:3301:copy_sticky_events:webrtcbin0:src_1 store sticky event stream-start event: 0x7f4dc40055e0, time 99:99:99.999999999, seq-num 741, GstEventStreamStart, stream-id=(string)d86ca30418e5b0ec624d6b445597ed11, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)6;
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.074097198 212 0x7f4df02a21e0 DEBUG webrtcbin gstwebrtcbin.c:3301:copy_sticky_events:webrtcbin0:src_1 store sticky event caps event: 0x7f4dc8001c40, time 99:99:99.999999999, seq-num 17928, GstEventCaps, caps=(GstCaps)"application/x-rtp,\ media=(string)video,\ payload=(int)99,\ clock-rate=(int)90000,\ encoding-name=(string)RTX,\ apt=(string)110,\ ssrc=(uint)572172575";
app_1 | 0:00:09.074150118 212 0x7f4df02a21e0 DEBUG webrtcbin gstwebrtcbin.c:3301:copy_sticky_events:webrtcbin0:src_1 store sticky event segment event: 0x7f4dc4005650, time 99:99:99.999999999, seq-num 736, GstEventSegment, segment=(GstSegment)"GstSegment, flags=(GstSegmentFlags)GST_SEGMENT_FLAG_NONE, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, base=(guint64)0, offset=(guint64)0, start=(guint64)0, stop=(guint64)18446744073709551615, time=(guint64)0, position=(guint64)0, duration=(guint64)18446744073709551615;";
app_1 | (python3:212): GStreamer-CRITICAL **: 16:16:35.793: Padname src_1 is not unique in element webrtcbin0, not adding
app_1 | #ERR#Stream 5bcf2d353a11a300394baf0f#: 0:00:09.130071459 212 0x7f4df0095940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<nicesrc3>
error: Internal data stream error.
app_1 | 0:00:09.130115420 212 0x7f4df0095940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<nicesrc3>
error: streaming stopped, reason not-linked (-1)
app_1 | #Stream 5bcf2d353a11a300394baf0f#: BUS ERROR: gst-stream-error-quark 1 | DEBUG: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:episode_5bcf2d353a11a300394baf0f/GstBin:compositor_1001/GstWebRTCBin:webrtcbin0/TransportReceiveBin:transportreceivebin1/GstNiceSrc:nicesrc3:
app_1 | streaming stopped, reason not-linked (-1)
With WebRTC peer on Google Chrome everything is OK (SDP answer is almost the same) and ULPFEC decoder is create earilier. On iOS it is somehow delayed.
I've looked into the source code and found two possible bug-causing lines:
https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/webrtc/gstwebrtcbin.c#L4506-L4507
https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/webrtc/gstwebrtcbin.c#L4589-L4594
Version: 1.14.x