mirror of
https://github.com/samsonjs/media.git
synced 2026-04-03 10:55:48 +00:00
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
(cherry picked from commit 0b7e5bbad2)
This commit is contained in:
parent
9ad5650876
commit
096981920f
1 changed files with 9 additions and 0 deletions
|
|
@ -22,9 +22,11 @@ import static com.google.android.exoplayer2.util.Util.SDK_INT;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.media.MediaFormat;
|
||||
import android.util.Pair;
|
||||
import android.view.Surface;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
|
||||
import com.google.android.exoplayer2.util.MediaFormatUtil;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
||||
|
|
@ -90,6 +92,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
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
|
||||
String mediaCodecName = EncoderUtil.findCodecForFormat(mediaFormat, /* isDecoder= */ true);
|
||||
if (mediaCodecName == null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue