Remove B-frame setting from DefaultEncoderFactory

This setting is buggy on some devices (for example sm-n960f)

PiperOrigin-RevId: 529712770
This commit is contained in:
kimvde 2023-05-05 14:36:50 +00:00 committed by Tofunmi Adigun-Hameed
parent 511b1358cd
commit 30957df635
2 changed files with 4 additions and 2 deletions

View file

@ -121,6 +121,8 @@
an input frame was pending processing.
* Query codecs via `MediaCodecList` instead of using
`findDecoder/EncoderForFormat` utilities, to expand support.
* Remove B-frame configuration in `DefaultEncoderFactory` because it
doesn't work on some devices.
* Muxer:
* Add a new muxer library which can be used to create an MP4 container
file.

View file

@ -549,10 +549,10 @@ public final class DefaultEncoderFactory implements Codec.EncoderFactory {
EncoderUtil.findHighestSupportedEncodingLevel(
encoderInfo, mimeType, expectedEncodingProfile);
if (supportedEncodingLevel != EncoderUtil.LEVEL_UNSET) {
// Use the highest supported profile and use B-frames.
// Use the highest supported profile. Don't configure B-frames, because it doesn't work on
// some devices.
mediaFormat.setInteger(MediaFormat.KEY_PROFILE, expectedEncodingProfile);
mediaFormat.setInteger(MediaFormat.KEY_LEVEL, supportedEncodingLevel);
mediaFormat.setInteger(MediaFormat.KEY_MAX_B_FRAMES, 1);
}
} else if (Util.SDK_INT >= 26) {
int expectedEncodingProfile = MediaCodecInfo.CodecProfileLevel.AVCProfileHigh;