-
Notifications
You must be signed in to change notification settings - Fork 6k
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
When to call setSelectionOverride? #2343
Comments
It's helpful to distinguish between synchronous and asynchronous track selection. By synchronous I mean the tracks are selected on the playback thread prior to media being buffered. By asynchronous I mean a message is passed to the application thread and a selection is then passed back to the playback thread. With asynchronous selection there's a small "gap" during which the wrong selection is being buffered, and so it's less efficient at the start of playback. For selection during playback (e.g. as a result of user interaction) asynchronous selection is fine. Your
As above, it's preferable to use
Yes.
It's easy to do this for DASH. I don't think it's possible to do this with HLS at this time. It's complicated in the HLS case by the fact we need to fetch a media chunk to determine what the tracks are. |
OK, we'll see how far we get with Thank you so much for your explanations! |
Oh, one additional question if you don't mind... Does the following make sense - I mean from the viewpoint of ExoPlayer architecture, and assuming you know the structure of the HLS playlists you are playing:
and
Except for the fact that |
The factory ( Note 1: What you're doing will probably work fine, it's just not doing things in the way the API was intended to be used. It's also quite fragile to rely on the ordering of the tracks. I don't think we guarantee anywhere to preserve the ordering (although I can't think of a reason why we'd be likely to change it). Note 2: If you're making a track selection that doesn't contain the first track at all, and still see the first track being played out before adapting to your selection, I'd consider that a bug. |
I've filed #2353 to track the final note above. We'll merge a change to use bitrate as a tie-breaker for fixed track selection early next week. |
If we don't have resolutions (and therefore cannot determine pixel counts) then use bitrate as a tie breaker instead. Also use pixel count as a tie breaker if pixel counts are known but equal. Streams with known pixel counts will always be preferred over streams without. Issue: #2343 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=145269968
We are in the process of moving our app(s) to ExoPlayer 2 and I need to get a grip on how track selection works exactly (for HLS streams).
From looking at your demo app I learned to use
DefaultTrackSelector.setSelectionOverride()
- however, I have few questions:Is this the only/clearly preferred way of tuning the track selection (for HLS streams) or is there a way to "front load" the process? (With ExoPlayer 1, for example, we had our own
HLSRendererBuilder
where we could reverse the list ofVariant
s before theRenderer
was even built).Is
ExoPlayer.EventListener.onTracksChanged()
a good place to callsetSelectionOverride()
? I wasn't able to find any earlier place where I already had access to the tracks...Is it correct/safe to call
DefaultTrackSelector.getCurrentMappedTrackInfo()
inside ofonTracksChanged()
? It seems to be because the tracks are set withtrackSelector.onSelectionActivated(trackInfo.info)
before callingonTracksChanged
inExoPlayerImpl
, but I'd like be sure that there are no possible race conditions or other problems when doing something like this:I seemed to need
trackSelector.getCurrentMappedTrackInfo()
to check which groups/tracks are actual video tracks - is there a better way to build theSelectionOverride
directly from theTrackGroupArray
andTrackSelectionArray
that are passed toonTracksChanged()
?But order of the track indices didn't seem to make a difference because of the
InitializationTrackSelection
inHlsChunkSource
.Sorry for my long and rambling post, but I hope my questions ultimately make sense!
The text was updated successfully, but these errors were encountered: