question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New remote tracks with same stream.id (in a=msid) are ignored in iOS (known problem)

See original GitHub issue

I have a react-native-webrtc peerconnection and, initially, call pc.setRemoteDescription(offer) with an offer as follows:

v=0
o=mediasoup-client 56448044 1 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-lite
a=fingerprint:sha-512 2B:19:7E:44:2A:92:E8:49:EE:FA:8E:C5:D3:EC:79:A3:E3:22:A3:E8:B3:C7:7C:9D:A5:6A:F3:F7:B3:BA:50:AF:58:1B:36:96:05:67:D8:6A:EE:F6:89:09:01:E4:98:6B:10:03:75:AD:14:7F:36:A6:6E:FD:9A:49:0A:DB:DF:BC
a=msid-semantic: WMS *
a=group:BUNDLE audio
m=audio 7 RTP/SAVPF 100
c=IN IP4 127.0.0.1
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=setup:actpass
a=mid:audio
a=sendonly
a=ice-ufrag:zzacfqcdz53izo9w
a=ice-pwd:8w3tkz1u8i0rg9ul9xwaxgavp3xc5mve
a=candidate:udpcandidate 1 udp 1082702079 192.168.1.92 40159 typ host
a=end-of-candidates
a=ice-options:renomination
a=ssrc:61428989 msid:recv-stream-61369657 consumer-audio-93108211
a=ssrc:61428989 mslabel:recv-stream-61369657
a=ssrc:61428989 label:consumer-audio-93108211
a=ssrc:61428989 cname:aJ9EdjJjV0S/hP05
a=rtcp-mux
a=rtcp-rsize

As expected, once applied the pc has a single remote stream (pc.getRemoteStreams()[0]) with id recv-stream-61369657. And such a stream has a single audio track with id consumer-audio-93108211.

After that, I run pc.createAnswer() and pc.setLocalDescription(answer).

Later, I call pc.setRemoteDescription(offer) with a new offer as follows:

v=0
o=mediasoup-client 56448044 2 IN IP4 0.0.0.0
s=-
t=0 0
a=ice-lite
a=fingerprint:sha-512 2B:19:7E:44:2A:92:E8:49:EE:FA:8E:C5:D3:EC:79:A3:E3:22:A3:E8:B3:C7:7C:9D:A5:6A:F3:F7:B3:BA:50:AF:58:1B:36:96:05:67:D8:6A:EE:F6:89:09:01:E4:98:6B:10:03:75:AD:14:7F:36:A6:6E:FD:9A:49:0A:DB:DF:BC
a=msid-semantic: WMS *
a=group:BUNDLE audio video
m=audio 7 RTP/SAVPF 100
c=IN IP4 127.0.0.1
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=setup:actpass
a=mid:audio
a=sendonly
a=ice-ufrag:zzacfqcdz53izo9w
a=ice-pwd:8w3tkz1u8i0rg9ul9xwaxgavp3xc5mve
a=candidate:udpcandidate 1 udp 1082702079 192.168.1.92 40159 typ host
a=end-of-candidates
a=ice-options:renomination
a=ssrc:61428989 msid:recv-stream-61369657 consumer-audio-93108211
a=ssrc:61428989 mslabel:recv-stream-61369657
a=ssrc:61428989 label:consumer-audio-93108211
a=ssrc:61428989 cname:aJ9EdjJjV0S/hP05
a=rtcp-mux
a=rtcp-rsize
m=video 7 RTP/SAVPF 101 102
c=IN IP4 127.0.0.1
a=rtpmap:101 VP8/90000
a=rtpmap:102 rtx/90000
a=fmtp:102 apt=101
a=rtcp-fb:101 ccm fir
a=rtcp-fb:101 nack 
a=rtcp-fb:101 nack pli
a=rtcp-fb:101 goog-remb 
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:4 urn:3gpp:video-orientation
a=setup:actpass
a=mid:video
a=sendonly
a=ice-ufrag:zzacfqcdz53izo9w
a=ice-pwd:8w3tkz1u8i0rg9ul9xwaxgavp3xc5mve
a=candidate:udpcandidate 1 udp 1082702079 192.168.1.92 40159 typ host
a=end-of-candidates
a=ice-options:renomination
a=ssrc:68973725 msid:recv-stream-61369657 consumer-video-82431751
a=ssrc:68973725 mslabel:recv-stream-61369657
a=ssrc:68973725 label:consumer-video-82431751
a=ssrc:68973725 cname:aJ9EdjJjV0S/hP05
a=ssrc:67505726 msid:recv-stream-61369657 consumer-video-82431751
a=ssrc:67505726 mslabel:recv-stream-61369657
a=ssrc:67505726 label:consumer-video-82431751
a=ssrc:67505726 cname:aJ9EdjJjV0S/hP05
a=ssrc-group:FID 68973725 67505726
a=rtcp-mux
a=rtcp-rsize

Here we have a new remote track (of kind “video” and track.id: "consumer-video-82431751") within the same remote stream (`stream.id: “recv-stream-61369657”).

BUT: If I iterate now the remote streams of the peerconnection:

  • I get a single remote stream with id “recv-stream-61369657” (this is correct).
  • The remote stream STILL has a single track (the audio track inserted above).
  • So the new video track is NOT available in the remote stream.

Expected behavior

After applying the second remote offer, the single remote stream should contain TWO tracks (audio and video).

Observed behavior

After applying the second remote offer, the single remote stream JUST contains the first track (the audio one).

Platform information

  • React Native version: master
  • Plugin version: 1.58.3
  • OS: iOS Simulator

Comments

I think this is related to how react-native-webrtc handles remote streams. AFAIS it ignores new tracks additions within an existing remote stream. Probably this is 100% related to an issue in the libwebrtc ObjC wrapper I already dealt with in the past:

In fact, I did a patch in libwebrtc for this (that fixes the issue) but was not approved by the libwebrtc team (who knows why): https://webrtc-codereview.appspot.com/50109004

Should I assume that the same issue happens here, so react-native-webrtc (when in iOS) cannot deal with track addition/removal on an already existing remote stream, right?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
saghulcommented, Jul 24, 2019

Update: the WebRTC objc wrapper got some new goodies and this should now be within reach. In fact there is an open PR with the fix: https://github.com/react-native-webrtc/react-native-webrtc/pull/564

Alas, not all the glitter is gold: there is no such API for Android AFAICT.

I’ll consider landing the PR after the next release. After all, being correct 50% of the times is better than being correct 0% of the times. But consistency is nice. Hum.

0reactions
saghulcommented, Oct 4, 2022

Closing since this no longer applies after the migration to unified plan.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS 15 Safari WebRTC Issue | Apple Developer Forums
We're encountering an issue on the iOS 15 Beta when establishing a WebRTC connection through Safari, where we are not receiving the remote...
Read more >
WebRTC iOS: remote video is not shown in iOS client
I was giving a hard coded string as id when creating stream and video track. which when a connection is established becomes the...
Read more >
Receiving multiple remote tracks/streams · Issue #144 - GitHub
I make a peer connection to a relay server using a unique connection ID. If any other (remote) peers connect to the relay...
Read more >
iPhone apps can track you even after you tell them not to
It asks if you're okay with the app “tracking” you, a question iPhones started displaying in April as part of a privacy crackdown...
Read more >
Use Your iPhone or Apple Watch as a Remote Control for ...
You could use a third-party remote access app, but most require a paid ... Each device must be signed in to iCloud using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found