add estimated bitrate for known formats

This commit is contained in:
chrisk325 2026-02-27 18:59:00 +05:30 committed by GitHub
parent c63af981ab
commit b3d4953da2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1605,8 +1605,16 @@ public class ReactExoplayerView extends FrameLayout implements
if (format.channelCount != Format.NO_VALUE && format.channelCount > 0) {
existing = existing + "|ch:" + format.channelCount;
}
if (format.bitrate != Format.NO_VALUE && format.bitrate > 0) {
existing = existing + "|br:" + format.bitrate;
// Use bitrate, fall back to averageBitrate then peakBitrate
int effectiveBitrate = format.bitrate;
if (effectiveBitrate == Format.NO_VALUE || effectiveBitrate <= 0) {
effectiveBitrate = format.averageBitrate;
}
if (effectiveBitrate == Format.NO_VALUE || effectiveBitrate <= 0) {
effectiveBitrate = format.peakBitrate;
}
if (effectiveBitrate != Format.NO_VALUE && effectiveBitrate > 0) {
existing = existing + "|br:" + effectiveBitrate;
}
if (!existing.isEmpty()) {
audioTrack.setTitle(existing);
@ -1810,8 +1818,16 @@ public class ReactExoplayerView extends FrameLayout implements
if (format.channelCount != Format.NO_VALUE && format.channelCount > 0) {
baseTitle = baseTitle + "|ch:" + format.channelCount;
}
if (format.bitrate != Format.NO_VALUE && format.bitrate > 0) {
baseTitle = baseTitle + "|br:" + format.bitrate;
// Use bitrate, fall back to averageBitrate then peakBitrate
int effectiveBitrate = format.bitrate;
if (effectiveBitrate == Format.NO_VALUE || effectiveBitrate <= 0) {
effectiveBitrate = format.averageBitrate;
}
if (effectiveBitrate == Format.NO_VALUE || effectiveBitrate <= 0) {
effectiveBitrate = format.peakBitrate;
}
if (effectiveBitrate != Format.NO_VALUE && effectiveBitrate > 0) {
baseTitle = baseTitle + "|br:" + effectiveBitrate;
}
track.setTitle(baseTitle);
track.setSelected(false); // Don't report selection status - let PlayerView handle it