google / ExoPlayer

An extensible media player for Android
Apache License 2.0
21.64k stars 6k forks source link

FORMAT_EXCEEDS_CAPABILITIES for switching tracks #2015

Closed luxband closed 7 years ago

luxband commented 7 years ago

Hi, Stream has two tracks: video H264 - MPEG-4 AVC (part 10) (h264) + audio-tracks MPEG Audio layer 1/2 (mpga) Audio track is defined in exoplayer with flag FORMAT_EXCEEDS_CAPABILITIES. When playing stream by default - the audio is not played.

Using in TrackSelector.onTrackSelectionsChanged explicitly switch to the audio track by TrackSelector.setSelectionOverride () - the audio track begins playing.

The same approach when playing stream that contains only one audio track (radio) does not always work - audio track not allways plays. Prompt, in what could be the problem? Can I use tracks with flag FORMAT_EXCEEDS_CAPABILITIES for switching?

ojw28 commented 7 years ago

FORMAT_EXCEEDS_CAPABILITIES indicates that the device has a decoder for the format, but this decoder indicates that it doesn't support the specific properties of the track. For audio this typically means the decoder doesn't support the sample rate + number of channels. For video this typically means the decoder doesn't support the resolution + frame-rate (and profile, in some cases).

If the device reports its capabilities accurately then attempting to enable a track labelled in this way is expected to fail. You can try and force enable it regardless if you think you know better, but as per the previous sentence, you should expect failure in absence of any other information you have.

For the sample stream that does work if you enable it regardless, I suggest you report the issue to Amlogic. If you're using the same streams as #2014, the issue is that the AudioCapabilities for their audio/mpeg-L2 decoder does not claim to support channels=1 and sample_rate=48000.