Add PayloadToMimeType map to StreamInfo #346
Open
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.
Description
This issue arose during the implementation of a RED FEC decoder interceptor. A sender can announce both an original codec (Opus, in this example) and RED in the SDP as follows:
Following this announcement, the sender may or may not use RED for audio transmission. Furthermore, the sender can dynamically switch between unprotected Opus and RED-protected streams during a session.
Currently, the receiver's interceptor has no way to determine the MIME type of a received packet. The StreamInfo structure only contains the capabilities of the first negotiated codec for the media section, which is not always the codec being used for transmission.
This PR resolves this ambiguity by adding a PayloadToMimeType map to StreamInfo. This allows decoder interceptors to match a received packet's payload type to its corresponding MIME type. For instance, with this change, the RED FEC decoder interceptor can now reliably differentiate between unprotected audio packets and RED-protected audio packets.
Implementation PR
The PayloadToMimeType field is set within the pion/webrtc repository. The work is handled by the following pull request: pion/webrtc#3175
This corresponding PR is currently a draft because it depends on the changes from this PR. Once this is merged, the pion/webrtc PR will be updated with a commit that bumps its dependency on this repository to include these changes, and it can then be finalized for review.