Commit c0f911ba by christosts Committed by Rohit Singh

Change format logged when AudioSink throws InitializationException

Change what format is logged from MediaCodecAudioRenderer when
AudioSink throws InitializationException. We printed the
AudioSink's format, which most of the times is audio/raw (PCM)
and not the renderer's format. With this change both formats are
logged.

#minor-release

Issue: google/ExoPlayer#11066
PiperOrigin-RevId: 523456840
(cherry picked from commit 81d9c6c1)
parent 9d028b33
...@@ -185,6 +185,8 @@ public interface AudioSink { ...@@ -185,6 +185,8 @@ public interface AudioSink {
+ audioTrackState + audioTrackState
+ " " + " "
+ ("Config(" + sampleRate + ", " + channelConfig + ", " + bufferSize + ")") + ("Config(" + sampleRate + ", " + channelConfig + ", " + bufferSize + ")")
+ " "
+ format
+ (isRecoverable ? " (recoverable)" : ""), + (isRecoverable ? " (recoverable)" : ""),
audioTrackException); audioTrackException);
this.audioTrackState = audioTrackState; this.audioTrackState = audioTrackState;
......
...@@ -100,6 +100,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media ...@@ -100,6 +100,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
private int codecMaxInputSize; private int codecMaxInputSize;
private boolean codecNeedsDiscardChannelsWorkaround; private boolean codecNeedsDiscardChannelsWorkaround;
@Nullable private Format inputFormat;
/** Codec used for DRM decryption only in passthrough and offload. */ /** Codec used for DRM decryption only in passthrough and offload. */
@Nullable private Format decryptOnlyCodecFormat; @Nullable private Format decryptOnlyCodecFormat;
...@@ -495,8 +496,9 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media ...@@ -495,8 +496,9 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
@Nullable @Nullable
protected DecoderReuseEvaluation onInputFormatChanged(FormatHolder formatHolder) protected DecoderReuseEvaluation onInputFormatChanged(FormatHolder formatHolder)
throws ExoPlaybackException { throws ExoPlaybackException {
inputFormat = checkNotNull(formatHolder.format);
@Nullable DecoderReuseEvaluation evaluation = super.onInputFormatChanged(formatHolder); @Nullable DecoderReuseEvaluation evaluation = super.onInputFormatChanged(formatHolder);
eventDispatcher.inputFormatChanged(formatHolder.format, evaluation); eventDispatcher.inputFormatChanged(inputFormat, evaluation);
return evaluation; return evaluation;
} }
...@@ -599,6 +601,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media ...@@ -599,6 +601,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
@Override @Override
protected void onDisabled() { protected void onDisabled() {
audioSinkNeedsReset = true; audioSinkNeedsReset = true;
inputFormat = null;
try { try {
audioSink.flush(); audioSink.flush();
} finally { } finally {
...@@ -706,7 +709,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media ...@@ -706,7 +709,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
fullyConsumed = audioSink.handleBuffer(buffer, bufferPresentationTimeUs, sampleCount); fullyConsumed = audioSink.handleBuffer(buffer, bufferPresentationTimeUs, sampleCount);
} catch (InitializationException e) { } catch (InitializationException e) {
throw createRendererException( throw createRendererException(
e, e.format, e.isRecoverable, PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED); e, inputFormat, e.isRecoverable, PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED);
} catch (WriteException e) { } catch (WriteException e) {
throw createRendererException( throw createRendererException(
e, format, e.isRecoverable, PlaybackException.ERROR_CODE_AUDIO_TRACK_WRITE_FAILED); e, format, e.isRecoverable, PlaybackException.ERROR_CODE_AUDIO_TRACK_WRITE_FAILED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment