mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix IndexOutOfBounds when there are no available codecs
PiperOrigin-RevId: 249610014
This commit is contained in:
parent
cf93b8e73e
commit
2e1ea379c3
1 changed files with 4 additions and 5 deletions
|
|
@ -53,7 +53,6 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -742,11 +741,11 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
||||||
try {
|
try {
|
||||||
List<MediaCodecInfo> allAvailableCodecInfos =
|
List<MediaCodecInfo> allAvailableCodecInfos =
|
||||||
getAvailableCodecInfos(mediaCryptoRequiresSecureDecoder);
|
getAvailableCodecInfos(mediaCryptoRequiresSecureDecoder);
|
||||||
|
availableCodecInfos = new ArrayDeque<>();
|
||||||
if (enableDecoderFallback) {
|
if (enableDecoderFallback) {
|
||||||
availableCodecInfos = new ArrayDeque<>(allAvailableCodecInfos);
|
availableCodecInfos.addAll(allAvailableCodecInfos);
|
||||||
} else {
|
} else if (!allAvailableCodecInfos.isEmpty()) {
|
||||||
availableCodecInfos =
|
availableCodecInfos.add(allAvailableCodecInfos.get(0));
|
||||||
new ArrayDeque<>(Collections.singletonList(allAvailableCodecInfos.get(0)));
|
|
||||||
}
|
}
|
||||||
preferredDecoderInitializationException = null;
|
preferredDecoderInitializationException = null;
|
||||||
} catch (DecoderQueryException e) {
|
} catch (DecoderQueryException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue