MediaCodecUtil { @Nullable public static Pair<Integer, Integer> getCodecProfileAndLevel(Format format) { if (format.codecs == null) { return null; } String[] parts = format.codecs.split("\\."); if (MimeTypes.VIDEO_DOLBY_VISION.equals(format.sampleMimeType)) { return getDolbyVisionProfileAndLevel(format.codecs, parts); } switch (parts[0]) { case CODEC_ID_AVC1: case CODEC_ID_AVC2: return getAvcProfileAndLevel(format.codecs, parts); case CODEC_ID_VP09: return getVp9ProfileAndLevel(format.codecs, parts); case CODEC_ID_HEV1: case CODEC_ID_HVC1: return getHevcProfileAndLevel(format.codecs, parts); case CODEC_ID_AV01: return getAv1ProfileAndLevel(format.codecs, parts, format.colorInfo); case CODEC_ID_MP4A: return getAacCodecProfileAndLevel(format.codecs, parts); default: return null; } } private  MediaCodecUtil(); static void warmDecoderInfoCache(String mimeType, boolean secure, boolean tunneling); @Nullable static MediaCodecInfo getPassthroughDecoderInfo(); @Nullable static MediaCodecInfo getDecoderInfo(String mimeType, boolean secure, boolean tunneling); static synchronized List<MediaCodecInfo> getDecoderInfos(
      String mimeType, boolean secure, boolean tunneling); @CheckResult static List<MediaCodecInfo> getDecoderInfosSortedByFormatSupport(
      List<MediaCodecInfo> decoderInfos, Format format); static int maxH264DecodableFrameSize(); @Nullable static Pair<Integer, Integer> getCodecProfileAndLevel(Format format);  }
@Test public void getCodecProfileAndLevel_rejectsNullCodecString() { Format format = Format.createVideoSampleFormat( null, MimeTypes.VIDEO_UNKNOWN, null, Format.NO_VALUE, Format.NO_VALUE, 1024, 768, Format.NO_VALUE, null, null); assertThat(MediaCodecUtil.getCodecProfileAndLevel(format)).isNull(); }
@Test public void getCodecProfileAndLevel_rejectsEmptyCodecString() { Format format = Format.createVideoSampleFormat( null, MimeTypes.VIDEO_UNKNOWN, "", Format.NO_VALUE, Format.NO_VALUE, 1024, 768, Format.NO_VALUE, null, null); assertThat(MediaCodecUtil.getCodecProfileAndLevel(format)).isNull(); }