mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Log instead of throwing for transfer mismatch
PiperOrigin-RevId: 470354448
This commit is contained in:
parent
91709831ed
commit
dbe6677551
1 changed files with 13 additions and 10 deletions
|
|
@ -36,6 +36,7 @@ import androidx.media3.common.C;
|
||||||
import androidx.media3.common.ColorInfo;
|
import androidx.media3.common.ColorInfo;
|
||||||
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.Log;
|
||||||
import androidx.media3.common.util.MediaFormatUtil;
|
import androidx.media3.common.util.MediaFormatUtil;
|
||||||
import androidx.media3.common.util.TraceUtil;
|
import androidx.media3.common.util.TraceUtil;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
|
|
@ -51,6 +52,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
/** A default {@link Codec} implementation that uses {@link MediaCodec}. */
|
/** A default {@link Codec} implementation that uses {@link MediaCodec}. */
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public final class DefaultCodec implements Codec {
|
public final class DefaultCodec implements Codec {
|
||||||
|
|
||||||
|
private static final String TAG = "DefaultCodec";
|
||||||
|
|
||||||
// MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float.
|
// MediaCodec decoders always output 16 bit PCM, unless configured to output PCM float.
|
||||||
// https://developer.android.com/reference/android/media/MediaCodec#raw-audio-buffers.
|
// https://developer.android.com/reference/android/media/MediaCodec#raw-audio-buffers.
|
||||||
private static final int MEDIA_CODEC_PCM_ENCODING = C.ENCODING_PCM_16BIT;
|
private static final int MEDIA_CODEC_PCM_ENCODING = C.ENCODING_PCM_16BIT;
|
||||||
|
|
@ -325,16 +329,15 @@ public final class DefaultCodec implements Codec {
|
||||||
ColorInfo expectedColorInfo =
|
ColorInfo expectedColorInfo =
|
||||||
isToneMappingEnabled ? ColorInfo.SDR_BT709_LIMITED : configurationFormat.colorInfo;
|
isToneMappingEnabled ? ColorInfo.SDR_BT709_LIMITED : configurationFormat.colorInfo;
|
||||||
if (!areColorTransfersEqual(expectedColorInfo, outputFormat.colorInfo)) {
|
if (!areColorTransfersEqual(expectedColorInfo, outputFormat.colorInfo)) {
|
||||||
// TODO(b/237674316): These exceptions throw when the container ColorInfo doesn't match
|
// TODO(b/237674316): The container ColorInfo's transfer doesn't match the decoder output
|
||||||
// the video ColorInfo. Instead of throwing when seeing unexpected ColorInfos, consider
|
// MediaFormat, or we requested tone-mapping but it hasn't bee applied. We should
|
||||||
// reconfiguring downstream components (ex. FrameProcessor and encoder) when different
|
// reconfigure downstream components for this case instead.
|
||||||
// ColorInfo values are output.
|
Log.w(
|
||||||
throw createTransformationException(
|
TAG,
|
||||||
new IllegalStateException(
|
"Codec output color format does not match configured color format. Expected: "
|
||||||
"Codec output color format does not match configured color format. Expected: "
|
+ expectedColorInfo
|
||||||
+ expectedColorInfo
|
+ ". Actual: "
|
||||||
+ ". Actual: "
|
+ outputFormat.colorInfo);
|
||||||
+ outputFormat.colorInfo));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue