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

Add support for RTSP AMR-NB/WB #46

Merged
merged 2 commits into from
Apr 11, 2022
Merged

Conversation

ManishaJajoo
Copy link
Contributor

Added AMR-NB/WB RTP packet reader and added support for AMR-NB/WB
playback through RTSP

Change-Id: I0a975fa1e1aa8450bda1c828599a523ba796bc48

Added AMR-NB/WB RTP packet reader and added support for AMR-NB/WB
playback through RTSP

Change-Id: I0a975fa1e1aa8450bda1c828599a523ba796bc48
case RTP_MEDIA_AMR:
return MimeTypes.AUDIO_AMR_NB;
case RTP_MEDIA_AMR_WB:
return MimeTypes.AUDIO_AMR_WB;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. RTP_MEDIA_AMR (which is "AMR"), corresponds to MIME type AUDIO_AMR_NB ("audio/3gpp") and not to AUDIO_AMR ("audio/amr")?

Do you know what would happen if you to map RTP_MEDIA_AMR to MimeTypes.AUDIO_AMR? Would the decoder work?

I skimmed through rfc4867 and I see that both AMR and AMR_WB can be stored in 3gpp files so I'd be tempted to see what happens when AMR_WB is also mapped to audio/3gpp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon setting the mimeType as AUDIO_AMR, the player fails in selectTracks. The reason for this failure is: AUDIO_AMR is treated as an unsupported mime type and therefore result.second is set to null here:
https://github.com/androidx/media/blob/main/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/MappingTrackSelector.java#L422

Regarding the second change, i.e. mapping AMR_WB to audio/3gpp, since AUDIO_AMR_NB creates an AMR_NB decoder and AUDIO_AMR_WB creates AMR_WB decoder we see the following playback error:
MediaCodecDecoderException: Decoder failed: c2.android.amrnb.decoder

@claincly
Copy link
Contributor

Merged internally. The issue will be marked as merged automatically when we do a push. Thanks for the contribution!

@icbaker icbaker merged commit a11c22b into androidx:main Apr 11, 2022
icbaker added a commit that referenced this pull request May 9, 2022
@androidx androidx locked and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants