Skip to content
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

Only add media bundle if offer SDP contains any media fields, useful for data only connections #913

Closed
fakuivan opened this issue Aug 3, 2023 · 1 comment
Labels
stale There has been no recent activity

Comments

@fakuivan
Copy link

fakuivan commented Aug 3, 2023

Disclaimer: I'm not a WebRTC expert, in fact I only know the basics to get a simple connection up, event then this bug almost made me quit using this library, this is why I'm reporting it.

In the cases where a data only peer connection needs to be established aiortc responds to an SDP offer with an answer containing an empty BUNDLE group, this empty group is supposed to be filled with some m=s, but it never does since no media is declared and Chrome complains failing to set up the connection, for firefox this works fine.

This is the error that pops up when adding the SDP from aiortc to the browser:

Error: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to set remote answer sdp: A BUNDLE group contains a MID='' matching no m= section.

Here's the SDP produced by the browser:

{
    "type": "offer",
    "sdp": "v=0\r\no=- 449907951519833443 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\n"
}

and here's the response from aiortc:

{
    "type": "answer",
    "sdp": "v=0\r\no=- 3900077871 3900077871 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=group:BUNDLE \r\na=msid-semantic:WMS *\r\n"
}

My solution was to change the following lines here:

bundle = sdp.GroupDescription(semantic="BUNDLE", items=[])
for media in description.media:
bundle.items.append(media.rtp.muxId)
description.group.append(bundle)

to this:

if len(description.media) > 0:
    bundle = sdp.GroupDescription(semantic="BUNDLE", items=[]) 
    for media in description.media: 
        bundle.items.append(media.rtp.muxId) 
    description.group.append(bundle) 

This is the answer after the fix:

{
    "type":"answer",
    "sdp":"v=0\r\no=- 3900078276 3900078276 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=msid-semantic:WMS *\r\n"
}

Is this fix correct? Would this pass as a pr?

Copy link

github-actions bot commented Dec 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale There has been no recent activity label Dec 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale There has been no recent activity
Projects
None yet
Development

No branches or pull requests

1 participant