-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot detect when a track is added by the remote peer #1135
Comments
Both peers are using SIPSorcery ? |
Both peers are using SIPSorcery. I have verified that the offer SDP contains a new video track. The issue appears to be here: sipsorcery/src/net/RTP/RTPSession.cs Lines 1015 to 1021 in 06f8e3c
When the remote peer sends a media track that the local peer does not know about, it creates a new MediaStream and sets the LocalTrack of that stream to Inactive. I am not a WebRTC expert, but I think that perhaps an ontrack event should be raised somewhere near the referenced code, and that the local track should not be created as inactive. |
Could you provide all SDP exchanged from both sides ? (and from the beginning including the creation of the PeerConnection) PeerA is the one adding the video track: So the SDP (as offer) sent must include two media (the one used to create the PeerConnection) and the new video with SendRecv or SendOnly Once this SDP is received on PeerB, it must add a Video MediaTrack with RecvOnly or SendRecv according your needs and create an SDP (as anwser) and send it to PeerA |
Here is the sequence of SDP exchanges: Local peer receiving offer:
Remote peer receiving answer:
Local peer receiving offer, with new video track:
Remote peer receiving answer:
|
You mean instead "Local peer creates offer", isn't it ?
You mean instead "Remote peer creates answer using offer", isn't it ?
Same as before: You mean instead "Local peer creates offer", isn't it ?
Again: You mean instead "Remote peer creates answer using offer", isn't it ? If all I assume before is correct,
|
No, I meant it the way I wrote it. I'm debugging both ends of the connection, and I was only logging the OfferReceived (called by the "local" peer) and AnswerReceived (called by the "remote" peer) methods. The remote peer is adding the video, and the local peer is answering with inactive. |
Ok my bad. |
That makes sense, but what is the best way to detect that the SDP offer contains a new video track? I would expect that the RTPSession would fire some kind of event to let my application know that the SDP offer contains a new video track. |
Perhaps there is a better way, but I'm doing this :
Extract
|
Notice also I follow this rules:
So I can manage this kind of scenario:
|
I see. Interesting workaround, basically using a dummy RTCPeerConnection as a parser. My workaround was searching for inactive tracks after setting the remote description on the live connection, but I think it's fragile. The WebRTC specification contains a "track" event (https://w3c.github.io/webrtc-pc/#event-track), which sipsorcery does not appear to implement. I am not certain, but I think the "track" event exists for just this situation. |
Actually, I see it commented out here: sipsorcery/src/net/WebRTC/IRTCPeerConnection.cs Lines 412 to 421 in 06f8e3c
|
Yes. Don't hesitate to create a PR ;) |
Dang, I was afraid you'd say that 😜 Guess that's my week sorted. |
The whole SDP & media re-negotiation logic was never implemented (it was hard enough to get things working with a single audio and video track). It's a sizeable job. |
Similar to #983.
I am attempting to add a media track some time after the peer connection has been established (this code is executed by the local peer):
Renegotiation occurs as expected, but at no point is the remote peer informed that the local peer has added a track. I have subscribed to and am logging every
RTCPeerConnection
event (includingOnRtpPacketReceivedByIndex
as mentioned in #983), but none of them are raised on the remote peer.Attempting to send any data over the track results in this logged warning, despite creating the track as SendOnly:
The text was updated successfully, but these errors were encountered: