Add workaround for Galaxy Tab S7 FE device PerformancePoint issue

The Galaxy Tab S7 FE has a device issue that causes 60fps secure H264 streams to be marked as unsupported. This CL adds a workaround for this issue by checking the CDD required support for secure H264 in addition to the current check on standard H264. If the provided performance points do not cover the CDD requirement of support 720p H264 at 60fps, then it falls back to using legacy methods for checking frame rate and resolution support.

Issue: androidx/media#1619
PiperOrigin-RevId: 675920968
This commit is contained in:
michaelkatz 2024-09-18 03:26:43 -07:00 committed by Copybara-Service
parent 69da26935e
commit f0fb386224
2 changed files with 26 additions and 5 deletions

View File

@ -29,6 +29,9 @@
* DataSource:
* Audio:
* Video:
* Add workaround for a device issue on Galaxy Tab S7 FE that causes 60fps
secure H264 streams to be marked as unsupported
([#1619](https://github.com/androidx/media/issues/1619)).
* Text:
* Metadata:
* Image:

View File

@ -137,6 +137,25 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// The same check as below is tested in CTS and we should get reliable results from API 35.
return false;
}
@PerformancePointCoverageResult
int h264RequiredSupportResult =
evaluateH264RequiredSupport(/* requiresSecureDecoder= */ false);
@PerformancePointCoverageResult
int h264SecureRequiredSupportResult =
evaluateH264RequiredSupport(/* requiresSecureDecoder= */ true);
if (h264RequiredSupportResult == COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED) {
return true;
}
if (h264SecureRequiredSupportResult == COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED) {
return h264RequiredSupportResult != COVERAGE_RESULT_YES;
}
return h264RequiredSupportResult != COVERAGE_RESULT_YES
|| h264SecureRequiredSupportResult != COVERAGE_RESULT_YES;
}
private static @PerformancePointCoverageResult int evaluateH264RequiredSupport(
boolean requiresSecureDecoder) {
try {
Format formatH264 = new Format.Builder().setSampleMimeType(MimeTypes.VIDEO_H264).build();
// Null check required to pass RequiresNonNull annotation on getDecoderInfosSoftMatch.
@ -145,7 +164,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
MediaCodecUtil.getDecoderInfosSoftMatch(
MediaCodecSelector.DEFAULT,
formatH264,
/* requiresSecureDecoder= */ false,
/* requiresSecureDecoder= */ requiresSecureDecoder,
/* requiresTunnelingDecoder= */ false);
for (int i = 0; i < decoderInfos.size(); i++) {
if (decoderInfos.get(i).capabilities != null
@ -160,15 +179,14 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
PerformancePoint targetPerformancePointH264 =
new PerformancePoint(/* width= */ 1280, /* height= */ 720, /* frameRate= */ 60);
return evaluatePerformancePointCoverage(
performancePointListH264, targetPerformancePointH264)
== COVERAGE_RESULT_NO;
performancePointListH264, targetPerformancePointH264);
}
}
}
}
return true;
return COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED;
} catch (MediaCodecUtil.DecoderQueryException ignored) {
return true;
return COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED;
}
}