Skip to content

Negotation issues between browsers and elixir webrtc #201

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

Open
Karolk99 opened this issue Feb 24, 2025 · 0 comments
Open

Negotation issues between browsers and elixir webrtc #201

Karolk99 opened this issue Feb 24, 2025 · 0 comments

Comments

@Karolk99
Copy link

I have a scenario where I'm trying to connect a client (browser) to a server using Elixir WebRTC. The PeerConnection on the server side does not accept any video codecs; the server is audio only. I noticed problems with negotiation in a specific scenario where we first add only video and negotiate for it, which rejects the video track (audio-only server), and then we add audio (to the same PeerConnection) and start negotiation again, which fails (the browser does not accept the SDP answer, or an ICE candidate).

In the case of the Chrome browser, the reason seems to be sending a value of 0 in the m-line port in response to the first negotiation. As a result, the second SDP offer does not contain the video track that was sent in the first offer.
For comparison, Chrome in the SDP answer sets the m-line port value to 9, thanks to which the second offer contains both tracks.

In the case of the Firefox browser, after applying the second SDP answer, the next ICE candidate from the server causes an error. Firefox sends the correct SDP offer (unlike Chrome) hence accepts the SDPAnswer. It seems to me that the problem with the error during the candidate application is that in the first SDP answer the m-line port was set to 0 by the server and it should not then send ICE candidates for that m-line.

Interestingly, Firefox (unlike Chrome) returns in the SDP answer an m-line port equal to 0 for video (just like Elixir WebRTC).

Code used to check how browsers behave in a similar situation:

pc1 = new RTCPeerConnection();
pc2 = new RTCPeerConnection();

pc1_tr1 = pc1.addTransceiver("video", {direction: "sendonly"});

offer = await pc1.createOffer();

await pc1.setLocalDescription(offer);
await pc2.setRemoteDescription(offer);

pc2.getTransceivers()[0].stop()

answer = await pc2.createAnswer();

await pc2.setLocalDescription(answer);
await pc1.setRemoteDescription(answer);

pc1_tr2 = pc1.addTransceiver("audio", {direction: "sendonly"});

offer2 = await pc1.createOffer();

await pc1.setLocalDescription(offer2);
await pc2.setRemoteDescription(offer2);

answer2 = await pc2.createAnswer();

await pc2.setLocalDescription(answer2);
await pc1.setRemoteDescription(answer2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant