Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to not ignore performance points for resolution and frame rate (3rd try) #21

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -538,12 +538,6 @@ public boolean isVideoSizeAndRateSupportedV21(int width, int height, double fram
int evaluation =
MediaCodecPerformancePointCoverageProvider.areResolutionAndFrameRateCovered(
videoCapabilities, width, height, frameRate);

// MIREGO added support for doNotIgnorePerformancePointsForResolutionAndFrameRate
if (evaluation == COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED && Util.doNotIgnorePerformancePointsForResolutionAndFrameRate) {
evaluation = COVERAGE_RESULT_NO;
}

if (evaluation == COVERAGE_RESULT_YES) {
return true;
} else if (evaluation == COVERAGE_RESULT_NO) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ private MediaCodecPerformancePointCoverageProvider() {}
*/
public static @PerformancePointCoverageResult int areResolutionAndFrameRateCovered(
VideoCapabilities videoCapabilities, int width, int height, double frameRate) {

// MIREGO: added support for doNotIgnorePerformancePointsForResolutionAndFrameRate
// some devices now drop lots of frames due to COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED
// we want to be able to disable it for some device models
if (Util.doNotIgnorePerformancePointsForResolutionAndFrameRate && Util.SDK_INT >= 29) {
int evaluation = Api29.areResolutionAndFrameRateCovered(videoCapabilities, width, height, frameRate);
if (evaluation == COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED) {
return COVERAGE_RESULT_NO;
}
return evaluation;
}

if (Util.SDK_INT < 29
|| (shouldIgnorePerformancePoints != null && shouldIgnorePerformancePoints)) {
return COVERAGE_RESULT_NO_PERFORMANCE_POINTS_UNSUPPORTED;
Expand Down