-
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
Add preferred mime type(s) to DefaultTrackSelector parameters #8320
Comments
It's always possible just to fork and replace However, we usually advise against this because How do your audio tracks actually differ? Do they have different mime types, samples rate, channel counts, bitrates? Another aspect that may be relevant is whether your device you are testing on supports playing the Dolby Digital plus track. If the track is not supported by the device, we'd always prefer a supported track if it exists (like AAC). Finally, there are some less intrusive alternatives to forking the entire
|
Hi, tonihei, Thank you very much for this detailed answer. It's very helpful. Honestly, I have never anticipated that I can get so detailed answer. The case of us is there are several audio tracks in the DASH manifest. There are encoded by AAC or Dolby AC-4 with different languages. The requirements are If you team can support this interface, such as
It will be good to us. The example DASH manifest is
In fact, I have modified compareTo(AudioTrackScore other) method in DefaultTrackSelector to make this work. But I understand this is much more difficult since you need to consider more situations from common platform perspective. Due to customer doesn't allow us to modify core library code, I can't use this method. And I used setSelectionOverride() in application layer and it can work. But I don't like this method since there is side-effect as you said. I'll try "override selectAudioTrack" method. Thanks a lot again. BR, |
Hi, tonihei, I tried your proposal 1:
It can work! But there is a block point: selectAudioTrack() needs to access "private" method getAdaptiveAudioTracks(). So that I have to change one line code in defaultTrackSelector. Is it possible for your team to change this method from "private" to "protected"? BR, |
Just to ensure I understand this requirement correctly: Your first criterium is the language. If the track's language matches your preference, it should always be preferred over other tracks no matter the codec or mime type. I think this part of the requirement can already be fulfilled by explicitly setting your preferred language (e.g. Side note: Your example manifest snippet doesn't contain language tags. Not sure if this was supposed to show the language selection requirement somehow.
I think we should just add this option to accommodate your requirement. For the preference ordering it should probably come after preferred languages and after specific format constraints (like
I think the idea would be that you just return a single Format for your preferred track. If you want to support audio adaptation with your special constraints you'd need to filter the formats yourself I think because there is no guarantee that |
Your understanding is fully correct.
Sorry for confusion. This request is from customer and I have no that kind of manifest in my hand. Just provided a "simple" version without "language" tags.
It works for us. And
I think you are right. Again, thanks a lot for your great help. I truly appreciate it very much. Your team is always warm-hearted and very efficient. Hope you and your family are healthy in this special period. |
In a similar case for languages we have two methods |
I hope your team can help to implement it since it will be more quickly to be merged. Thanks a lot in advance. |
This allows to set preferences based on MIME type for video and audio. The MIME type preference is applied after other explicit preferences and restrictions (e.g. language or max resolution), but before implicit preferences like bitrate. Issue: #8320 PiperOrigin-RevId: 350550543
I'd like to implement a customized TrackSelector. My situations are
trackSelector.setParameters( trackSelector .buildUponParameters() .setMaxVideoSizeSd() .setPreferredAudioLanguage("deu"));
But Current APIs can't satisfy my requirement. For example, I'd like to always set higher priority for Dolby Digital plus track than AAC audio track. It seems that current interface can't support it.
According to ExoPlayer official documentation (https://exoplayer.dev/customization.html),
TrackSelector – Implementing a custom TrackSelector allows an app developer to change the way in which tracks exposed by a MediaSource are selected for consumption by each of the available Renderers.
My first feeling is I need to copy all files under "library\core\src\main\java\com\google\android\exoplayer2\trackselection" folder into my application layer and then do some modification. Do you have any suggestion for this? Is there a better solution?
Thank you very much in advance.
The text was updated successfully, but these errors were encountered: