HDR: Set decoder codec profile and level if available.
This should be necessary to ensure decoders see fewer errors. Setting this resulted in removing native_dequeueOutputBuffer errors on OMX.MTK decoders for in-app tone mapping prototyping. PiperOrigin-RevId: 486715941
This commit is contained in:
parent
23e724a00b
commit
e510d9903f
@ -22,11 +22,13 @@ import static androidx.media3.common.util.Util.SDK_INT;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.MediaFormat;
|
import android.media.MediaFormat;
|
||||||
|
import android.util.Pair;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.MimeTypes;
|
import androidx.media3.common.MimeTypes;
|
||||||
import androidx.media3.common.util.MediaFormatUtil;
|
import androidx.media3.common.util.MediaFormatUtil;
|
||||||
|
import androidx.media3.exoplayer.mediacodec.MediaCodecUtil;
|
||||||
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||||
|
|
||||||
/** A default implementation of {@link Codec.DecoderFactory}. */
|
/** A default implementation of {@link Codec.DecoderFactory}. */
|
||||||
@ -90,6 +92,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
MediaFormat.KEY_COLOR_TRANSFER_REQUEST, MediaFormat.COLOR_TRANSFER_SDR_VIDEO);
|
MediaFormat.KEY_COLOR_TRANSFER_REQUEST, MediaFormat.COLOR_TRANSFER_SDR_VIDEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
Pair<Integer, Integer> codecProfileAndLevel = MediaCodecUtil.getCodecProfileAndLevel(format);
|
||||||
|
if (codecProfileAndLevel != null) {
|
||||||
|
MediaFormatUtil.maybeSetInteger(
|
||||||
|
mediaFormat, MediaFormat.KEY_PROFILE, codecProfileAndLevel.first);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
String mediaCodecName = EncoderUtil.findCodecForFormat(mediaFormat, /* isDecoder= */ true);
|
String mediaCodecName = EncoderUtil.findCodecForFormat(mediaFormat, /* isDecoder= */ true);
|
||||||
if (mediaCodecName == null) {
|
if (mediaCodecName == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user