Update to webrtc_track_id function for handling case without msid-semantic #887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the webrtc_track_id function in the SessionDescription class, found within sdp.py.
The main change implemented is an additional check for the scenario where msid-semantic is not provided. The updated code adds a check for this scenario, and in such cases, it directly returns bits[1] as the track id.
Prior to this update, the function would return None in scenarios where msid-semantic is not present in OFFER, as it strictly expected at least a msid-semantic to return a track id when an msid was present. This change thus enhances the function's flexibility and robustness in handling cases where media streams have an msid but no msid-semantic field is present.
This change was needed on my side to be able to connect an aiortc peer to Livekit SFU: Livekit does provide an msid for each track, but does not provide the msid-semantic field.
After some research, I found that it seems that the msid-semantic is not required (and may have been obsoleted between draft 08 and 09 of RFC-8830, see references below).
Here's a breakdown of the changes:
This update ensures that the webrtc_track_id function can handle all scenarios more effectively, returning a valid track id even in cases where msid-semantic is not present.
References:
msid-semantic description in draft version 08:
RFC-8830 (draft#08)
msid-semantic attribute removed in draft version 09:
RFC-8830 (draft#08)