Remove ExoPlaybackException factory method that doesn't take errorCode
PiperOrigin-RevId: 383379334
This commit is contained in:
parent
74f262615e
commit
a302e34992
@ -121,34 +121,6 @@ public final class ExoPlaybackException extends PlaybackException {
|
||||
return new ExoPlaybackException(TYPE_SOURCE, cause, errorCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of type {@link #TYPE_RENDERER} in which {@link #isRecoverable} is {@code
|
||||
* false} and {@link #errorCode} is {@link #ERROR_CODE_UNSPECIFIED}.
|
||||
*
|
||||
* @param cause The cause of the failure.
|
||||
* @param rendererIndex The index of the renderer in which the failure occurred.
|
||||
* @param rendererFormat The {@link Format} the renderer was using at the time of the exception,
|
||||
* or null if the renderer wasn't using a {@link Format}.
|
||||
* @param rendererFormatSupport The {@link FormatSupport} of the renderer for {@code
|
||||
* rendererFormat}. Ignored if {@code rendererFormat} is null.
|
||||
* @return The created instance.
|
||||
*/
|
||||
public static ExoPlaybackException createForRenderer(
|
||||
Throwable cause,
|
||||
String rendererName,
|
||||
int rendererIndex,
|
||||
@Nullable Format rendererFormat,
|
||||
@FormatSupport int rendererFormatSupport) {
|
||||
return createForRenderer(
|
||||
cause,
|
||||
rendererName,
|
||||
rendererIndex,
|
||||
rendererFormat,
|
||||
rendererFormatSupport,
|
||||
/* isRecoverable= */ false,
|
||||
ERROR_CODE_UNSPECIFIED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of type {@link #TYPE_RENDERER}.
|
||||
*
|
||||
|
@ -37,6 +37,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.RendererConfiguration;
|
||||
import com.google.android.exoplayer2.drm.DrmSessionEventListener;
|
||||
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
||||
@ -243,7 +244,9 @@ public class MediaCodecAudioRendererTest {
|
||||
"rendererName",
|
||||
/* rendererIndex= */ 0,
|
||||
format,
|
||||
C.FORMAT_HANDLED));
|
||||
C.FORMAT_HANDLED,
|
||||
/* isRecoverable= */ false,
|
||||
PlaybackException.ERROR_CODE_UNSPECIFIED));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -28,6 +28,7 @@ import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.FormatHolder;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.audio.AudioProcessor;
|
||||
import com.google.android.exoplayer2.audio.AudioProcessor.AudioFormat;
|
||||
import com.google.android.exoplayer2.audio.SonicAudioProcessor;
|
||||
@ -345,7 +346,8 @@ import java.nio.ByteBuffer;
|
||||
outputAudioFormat = sonicAudioProcessor.configure(outputAudioFormat);
|
||||
flushSonicAndSetSpeed(currentSpeed);
|
||||
} catch (AudioProcessor.UnhandledAudioFormatException e) {
|
||||
throw createRendererException(e);
|
||||
// TODO(internal b/192864511): Assign an adequate error code.
|
||||
throw createRendererException(e, PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
try {
|
||||
@ -358,7 +360,8 @@ import java.nio.ByteBuffer;
|
||||
.setAverageBitrate(DEFAULT_ENCODER_BITRATE)
|
||||
.build());
|
||||
} catch (IOException e) {
|
||||
throw createRendererException(e);
|
||||
// TODO(internal b/192864511): Assign an adequate error code.
|
||||
throw createRendererException(e, PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||
}
|
||||
encoderInputAudioFormat = outputAudioFormat;
|
||||
return true;
|
||||
@ -382,7 +385,8 @@ import java.nio.ByteBuffer;
|
||||
try {
|
||||
decoder = MediaCodecAdapterWrapper.createForAudioDecoding(inputFormat);
|
||||
} catch (IOException e) {
|
||||
throw createRendererException(e);
|
||||
// TODO (internal b/184262323): Assign an adequate error code.
|
||||
throw createRendererException(e, PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||
}
|
||||
speedProvider = new SegmentSpeedProvider(inputFormat);
|
||||
currentSpeed = speedProvider.getSpeed(0);
|
||||
@ -405,9 +409,15 @@ import java.nio.ByteBuffer;
|
||||
sonicAudioProcessor.flush();
|
||||
}
|
||||
|
||||
private ExoPlaybackException createRendererException(Throwable cause) {
|
||||
private ExoPlaybackException createRendererException(Throwable cause, int errorCode) {
|
||||
return ExoPlaybackException.createForRenderer(
|
||||
cause, TAG, getIndex(), inputFormat, /* rendererFormatSupport= */ C.FORMAT_HANDLED);
|
||||
cause,
|
||||
TAG,
|
||||
getIndex(),
|
||||
inputFormat,
|
||||
/* rendererFormatSupport= */ C.FORMAT_HANDLED,
|
||||
/* isRecoverable= */ false,
|
||||
errorCode);
|
||||
}
|
||||
|
||||
private static long getBufferDurationUs(long bytesWritten, int bytesPerFrame, int sampleRate) {
|
||||
|
@ -21,6 +21,7 @@ import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.FormatHolder;
|
||||
import com.google.android.exoplayer2.PlaybackException;
|
||||
import com.google.android.exoplayer2.Renderer;
|
||||
import com.google.android.exoplayer2.RendererCapabilities;
|
||||
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
|
||||
@ -107,7 +108,9 @@ public class FakeRenderer extends BaseRenderer {
|
||||
getName(),
|
||||
getIndex(),
|
||||
format,
|
||||
C.FORMAT_UNSUPPORTED_TYPE);
|
||||
C.FORMAT_UNSUPPORTED_TYPE,
|
||||
/* isRecoverable= */ false,
|
||||
PlaybackException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED);
|
||||
}
|
||||
formatsRead.add(format);
|
||||
onFormatChanged(format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user