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

Playback fails in demo app after selecting all the tracks from the same audio track group #5971

Closed
GouravSna opened this issue May 30, 2019 · 10 comments
Assignees
Labels

Comments

@GouravSna
Copy link

GouravSna commented May 30, 2019

Issue: Playback fails when we try to select all the tracks available in an audio group.

Media: https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8

Crash Log:

2019-05-30 14:15:49.249 12743-12743/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [14.12, 16.62, window=0, period=0]
    com.google.android.exoplayer2.ExoPlaybackException: java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:397)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=4; index=4
        at com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection.setCheckpointValues(AdaptiveTrackSelection.java:810)
        at com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection.getAllocationCheckpoints(AdaptiveTrackSelection.java:745)
        at com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection.access$000(AdaptiveTrackSelection.java:37)
        at com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection$Factory.createTrackSelections(AdaptiveTrackSelection.java:275)
        at com.google.android.exoplayer2.trackselection.DefaultTrackSelector.selectTracks(DefaultTrackSelector.java:1451)
        at com.google.android.exoplayer2.trackselection.MappingTrackSelector.selectTracks(MappingTrackSelector.java:400)
        at com.google.android.exoplayer2.MediaPeriodHolder.selectTracks(MediaPeriodHolder.java:209)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.reselectTracksInternal(ExoPlayerImplInternal.java:1100)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:357)
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65)

My Assumption: I am assuming that when I select all the tracks available from an audio group it will behave like adaptive (track Index = -1).

Question:
If I check the stream it has the following audio track group,

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/stereo/en/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"

#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/surround/en/320kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"

If I check the tracks in code then audio groups will be

  1. English(stereo)/English(surround) Unique Id: 1,0,0 / 1,0,1
  2. dubbing(stereo)/dubbing(surround) Unique Id: 1,1,0 / 1,1,1

How can we select auto for Audio ?

There could be following an option to select auto from English group (1,0,-1) or dubbing group (1,1,-1). Can we do this ? I tried but the app crashed.

How ExoPlayer is selecting the audio in case if I select auto ?

@GouravSna GouravSna changed the title Demo app crash after selecting all the tracks from the same audio track group Playback fails in demo app after selecting all the tracks from the same audio track group May 30, 2019
@ojw28 ojw28 self-assigned this May 30, 2019
@giladna
Copy link

giladna commented May 30, 2019

@ojw28
in previous version we were able to set adaptiveness in each of the groups since each audio group is working on its own language.

as for now the auto possibility is not available any more for each group
the questions is actually how adaptiveness for now is working across languages on latest version

@ojw28 ojw28 assigned tonihei and unassigned ojw28 May 30, 2019
@tonihei
Copy link
Collaborator

tonihei commented May 30, 2019

The reasons for this bug is that all the audio formats have no bitrate specified. We can and should make our algorithm more robust to gracefully handle this case, but I'm unsure what you are actually trying to achieve? There is no sensible way in which we can switch dynamically between two formats if they don't have bitrate information to guide the decision.

@tonihei
Copy link
Collaborator

tonihei commented May 30, 2019

@giladna I don't understand how your comment is related to the issue above. Can you rephrase it or open a new issue/question if unrelated?

@giladna
Copy link

giladna commented May 30, 2019

@tonihei
I was asking regarding auto bitrate selection in such case that 2 different languages are defined in 2 different groups

would it be possible to set auto bitrate selection for each group or auto bitrate selection is single option for a all audio tracks

@giladna
Copy link

giladna commented May 30, 2019

@ojw28 @tonihei

I am not sure in 100% but in m3u8 it is not expected to expose the audio bitrate compare to dash where adaptation set expose it.
so I guess stream is fine

@giladna
Copy link

giladna commented May 30, 2019

@ojw28 @tonihei

one more question is if auto bitrate selection in m3u8 is relevant at all in multi language case?
since it is not straight forward compare to dash

@giladna
Copy link

giladna commented May 30, 2019

Screen Shot 2019-05-30 at 4 47 24 PM
Screen Shot 2019-05-30 at 4 45 47 PM

Attached formats for same stream but once in m3u8 and once in dash formats
it can be noticed that the bitrates are not reported in the m3u8 case

@tonihei
Copy link
Collaborator

tonihei commented May 30, 2019

Yes, HLS streams mostly don't have specific audio bitrates as the provided bitrates are only for combined video+audio.

tonihei added a commit that referenced this issue May 30, 2019
Using parallel adaptation for Formats without bitrate information currently
causes an exception. Handle this gracefully and also cases where all formats
have the same bitrate.

Issue:#5971
PiperOrigin-RevId: 250682127
@tonihei
Copy link
Collaborator

tonihei commented May 30, 2019

Fixed by commit above.

@tonihei tonihei closed this as completed May 30, 2019
@giladna
Copy link

giladna commented May 30, 2019

@tonihei thanks!

Regarding selecting auto bitrate for specific language in dash
how would it be applicable using ParametersBuilder because changing to auto bitrate selection in multiple languages is done by sending empty selection overrride which can be used only for one language in that form

Screen Shot 2019-05-30 at 5 41 04 PM

GouravSna added a commit to kaltura/playkit-android that referenced this issue Jun 3, 2019
ojw28 pushed a commit that referenced this issue Jun 3, 2019
Using parallel adaptation for Formats without bitrate information currently
causes an exception. Handle this gracefully and also cases where all formats
have the same bitrate.

Issue:#5971
PiperOrigin-RevId: 250682127
giladna pushed a commit to kaltura/playkit-android that referenced this issue Jul 15, 2019
* - AndroidX migration
- Upgraded gson to 2.8.5
- Upgraded okhttp to 3.14.2
- Upgraded ExoPlayer to 2.10.1

* - API change for 2.10.1 for roleFlag in Subtitles
- Refactored MediaPlayerWrapper

* - Updated CustomVideoCodecRenderer class.
- Keeping the old file for the track.

* - Removed CustomVideoCodecRendererOld
- Added CustomMediaCodecRenderer

* - Decoder re-usability on change media.
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/ExoPlayer.html#setForegroundMode-boolean-

* - API Change : Added listener to bandwidth meter.

* - clean up

* - Restrict max supported bitrate to 5 Gbps
- ADAPTIVE support having -1 value is not supported in Exoplayer now, so changed the logic accordingly.

* - Issue Resolved: Lowest bitrate tracks was not being added.
- Now the isAdaptiveTrack is being analysed based on the flag present in the track.
- Removed the restriction of 5Gbps track. Logic is solely dependent on exoplayer now.

* - ExtractorMediaSource is deprecated.
- Code cleanup

* - Removed unused imports

* - Reverted track selection code
- google/ExoPlayer#5971

* - google/ExoPlayer#5991

Relying on Exoplayer for track selection

* - Role Flag was not being used
- Version updates for gson and okhttp
*     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@google google locked and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants