mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Update operating rate adjustment visibility
PiperOrigin-RevId: 723501709
This commit is contained in:
parent
b90610b95a
commit
85158ec841
@ -651,7 +651,7 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||
*
|
||||
* <p>The adjustment is applied in-place to {@code mediaFormat}.
|
||||
*/
|
||||
private static void adjustMediaFormatForEncoderPerformanceSettings(MediaFormat mediaFormat) {
|
||||
static void adjustMediaFormatForEncoderPerformanceSettings(MediaFormat mediaFormat) {
|
||||
if (Util.SDK_INT < 25) {
|
||||
// Not setting priority and operating rate achieves better encoding performance.
|
||||
return;
|
||||
@ -661,29 +661,11 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
|
||||
|
||||
if (Util.SDK_INT == 26) {
|
||||
mediaFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, DEFAULT_FRAME_RATE);
|
||||
} else if (deviceNeedsLowerOperatingRateAvoidingOverflowWorkaround()) {
|
||||
mediaFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, 1000);
|
||||
} else {
|
||||
mediaFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, Integer.MAX_VALUE);
|
||||
mediaFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, /* value= */ 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean deviceNeedsLowerOperatingRateAvoidingOverflowWorkaround() {
|
||||
// On these chipsets, setting an operating rate close to Integer.MAX_VALUE will cause the
|
||||
// encoder to throw at configuration time. Setting the operating rate to 1000 avoids being close
|
||||
// to an integer overflow limit while being higher than a maximum feasible operating rate. See
|
||||
// [internal b/311206113, b/317297946, b/312299527].
|
||||
return Util.SDK_INT >= 31
|
||||
&& Util.SDK_INT <= 34
|
||||
&& (Build.SOC_MODEL.equals("SM8550")
|
||||
|| Build.SOC_MODEL.equals("SM7450")
|
||||
|| Build.SOC_MODEL.equals("SM6450")
|
||||
|| Build.SOC_MODEL.equals("SC9863A")
|
||||
|| Build.SOC_MODEL.equals("T612")
|
||||
|| Build.SOC_MODEL.equals("T606")
|
||||
|| Build.SOC_MODEL.equals("T603"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Applying suggested profile settings from
|
||||
* https://developer.android.com/media/optimize/sharing#b-frames_and_encoding_profiles
|
||||
|
@ -248,8 +248,7 @@ public class DefaultEncoderFactoryTest {
|
||||
assertThat(configurationMediaFormat.containsKey(MediaFormat.KEY_PRIORITY)).isTrue();
|
||||
assertThat(configurationMediaFormat.getInteger(MediaFormat.KEY_PRIORITY)).isEqualTo(1);
|
||||
assertThat(configurationMediaFormat.containsKey(MediaFormat.KEY_OPERATING_RATE)).isTrue();
|
||||
assertThat(configurationMediaFormat.getInteger(MediaFormat.KEY_OPERATING_RATE))
|
||||
.isEqualTo(Integer.MAX_VALUE);
|
||||
assertThat(configurationMediaFormat.getInteger(MediaFormat.KEY_OPERATING_RATE)).isEqualTo(1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user