Migrate from MediaCodecList.getCodecCount to iterate getCodecInfos member function in MediaCodecVideoDecoderFactory
GetCodecCount is deprecated in API 21+ and getCodecInfos is encouraged to be used instead. See guidance: https://developer.android.com/reference/android/media/MediaCodecList#getCodecCount() Bug: webrtc:386857228 Change-Id: I3578809a550ef069562c521e47ce58e42ab2f5a8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374163 Reviewed-by: Zoé Lepaul <xalep@webrtc.org> Reviewed-by: Sergey Silkin <ssilkin@webrtc.org> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43745}
This commit is contained in:
parent
1dcd3b4ae2
commit
1ba220a816
@ -84,14 +84,8 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable MediaCodecInfo findCodecForType(VideoCodecMimeType type) {
|
private @Nullable MediaCodecInfo findCodecForType(VideoCodecMimeType type) {
|
||||||
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
|
final MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
|
||||||
MediaCodecInfo info = null;
|
for (MediaCodecInfo info : mediaCodecList.getCodecInfos()) {
|
||||||
try {
|
|
||||||
info = MediaCodecList.getCodecInfoAt(i);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Logging.e(TAG, "Cannot retrieve decoder codec info", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info == null || info.isEncoder()) {
|
if (info == null || info.isEncoder()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user