mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove createRendererException which doesn't take errorCode
And assign error codes to all callers. PiperOrigin-RevId: 383118513
This commit is contained in:
parent
0df0df9aee
commit
5bb2d0386f
@ -332,18 +332,6 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an {@link ExoPlaybackException} of type {@link ExoPlaybackException#TYPE_RENDERER} for
|
|
||||||
* this renderer.
|
|
||||||
*
|
|
||||||
* <p>Equivalent to {@link #createRendererException(Throwable, Format, int)
|
|
||||||
* createRendererException(cause, format, PlaybackException.ERROR_CODE_UNSPECIFIED)}.
|
|
||||||
*/
|
|
||||||
protected final ExoPlaybackException createRendererException(
|
|
||||||
Throwable cause, @Nullable Format format) {
|
|
||||||
return createRendererException(cause, format, PlaybackException.ERROR_CODE_UNSPECIFIED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an {@link ExoPlaybackException} of type {@link ExoPlaybackException#TYPE_RENDERER} for
|
* Creates an {@link ExoPlaybackException} of type {@link ExoPlaybackException#TYPE_RENDERER} for
|
||||||
* this renderer.
|
* this renderer.
|
||||||
|
@ -559,7 +559,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
try {
|
try {
|
||||||
mediaCrypto = new MediaCrypto(sessionMediaCrypto.uuid, sessionMediaCrypto.sessionId);
|
mediaCrypto = new MediaCrypto(sessionMediaCrypto.uuid, sessionMediaCrypto.sessionId);
|
||||||
} catch (MediaCryptoException e) {
|
} catch (MediaCryptoException e) {
|
||||||
throw createRendererException(e, inputFormat);
|
throw createRendererException(
|
||||||
|
e, inputFormat, PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR);
|
||||||
}
|
}
|
||||||
mediaCryptoRequiresSecureDecoder =
|
mediaCryptoRequiresSecureDecoder =
|
||||||
!sessionMediaCrypto.forceAllowInsecureDecoderComponents
|
!sessionMediaCrypto.forceAllowInsecureDecoderComponents
|
||||||
@ -569,7 +570,12 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
if (FrameworkMediaCrypto.WORKAROUND_DEVICE_NEEDS_KEYS_TO_CONFIGURE_CODEC) {
|
if (FrameworkMediaCrypto.WORKAROUND_DEVICE_NEEDS_KEYS_TO_CONFIGURE_CODEC) {
|
||||||
@DrmSession.State int drmSessionState = codecDrmSession.getState();
|
@DrmSession.State int drmSessionState = codecDrmSession.getState();
|
||||||
if (drmSessionState == DrmSession.STATE_ERROR) {
|
if (drmSessionState == DrmSession.STATE_ERROR) {
|
||||||
throw createRendererException(codecDrmSession.getError(), inputFormat);
|
// TODO(internal b/184262323): Assign a proper error code, once we attach that information
|
||||||
|
// to DrmSessionException.
|
||||||
|
throw createRendererException(
|
||||||
|
codecDrmSession.getError(),
|
||||||
|
inputFormat,
|
||||||
|
PlaybackException.ERROR_CODE_DRM_UNSPECIFIED);
|
||||||
} else if (drmSessionState != DrmSession.STATE_OPENED_WITH_KEYS) {
|
} else if (drmSessionState != DrmSession.STATE_OPENED_WITH_KEYS) {
|
||||||
// Wait for keys.
|
// Wait for keys.
|
||||||
return;
|
return;
|
||||||
@ -1295,7 +1301,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
resetInputBuffer();
|
resetInputBuffer();
|
||||||
}
|
}
|
||||||
} catch (CryptoException e) {
|
} catch (CryptoException e) {
|
||||||
throw createRendererException(e, inputFormat);
|
throw createRendererException(
|
||||||
|
e, inputFormat, C.getErrorCodeCorrespondingToPlatformDrmErrorCode(e.getErrorCode()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1365,7 +1372,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
inputIndex, /* offset= */ 0, buffer.data.limit(), presentationTimeUs, /* flags= */ 0);
|
inputIndex, /* offset= */ 0, buffer.data.limit(), presentationTimeUs, /* flags= */ 0);
|
||||||
}
|
}
|
||||||
} catch (CryptoException e) {
|
} catch (CryptoException e) {
|
||||||
throw createRendererException(e, inputFormat);
|
throw createRendererException(
|
||||||
|
e, inputFormat, C.getErrorCodeCorrespondingToPlatformDrmErrorCode(e.getErrorCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
resetInputBuffer();
|
resetInputBuffer();
|
||||||
@ -2151,7 +2159,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
try {
|
try {
|
||||||
mediaCrypto.setMediaDrmSession(getFrameworkMediaCrypto(sourceDrmSession).sessionId);
|
mediaCrypto.setMediaDrmSession(getFrameworkMediaCrypto(sourceDrmSession).sessionId);
|
||||||
} catch (MediaCryptoException e) {
|
} catch (MediaCryptoException e) {
|
||||||
throw createRendererException(e, inputFormat);
|
throw createRendererException(e, inputFormat, PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR);
|
||||||
}
|
}
|
||||||
setCodecDrmSession(sourceDrmSession);
|
setCodecDrmSession(sourceDrmSession);
|
||||||
codecDrainState = DRAIN_STATE_NONE;
|
codecDrainState = DRAIN_STATE_NONE;
|
||||||
@ -2167,7 +2175,8 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
// selection.
|
// selection.
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalArgumentException("Expecting FrameworkMediaCrypto but found: " + mediaCrypto),
|
new IllegalArgumentException("Expecting FrameworkMediaCrypto but found: " + mediaCrypto),
|
||||||
inputFormat);
|
inputFormat,
|
||||||
|
PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
return (FrameworkMediaCrypto) mediaCrypto;
|
return (FrameworkMediaCrypto) mediaCrypto;
|
||||||
}
|
}
|
||||||
|
@ -7185,7 +7185,9 @@ public final class ExoPlayerTest {
|
|||||||
if (audioRendererEnableCount.incrementAndGet() == 2) {
|
if (audioRendererEnableCount.incrementAndGet() == 2) {
|
||||||
// Fail when enabling the renderer for the second time during the playlist update.
|
// Fail when enabling the renderer for the second time during the playlist update.
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalStateException(), ExoPlayerTestRunner.AUDIO_FORMAT);
|
new IllegalStateException(),
|
||||||
|
ExoPlayerTestRunner.AUDIO_FORMAT,
|
||||||
|
PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -8704,7 +8706,9 @@ public final class ExoPlayerTest {
|
|||||||
// Fail when enabling the renderer. This will happen during the period
|
// Fail when enabling the renderer. This will happen during the period
|
||||||
// transition while the reading and playing period are different.
|
// transition while the reading and playing period are different.
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalStateException(), ExoPlayerTestRunner.AUDIO_FORMAT);
|
new IllegalStateException(),
|
||||||
|
ExoPlayerTestRunner.AUDIO_FORMAT,
|
||||||
|
PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1550,7 +1550,9 @@ public final class AnalyticsCollectorTest {
|
|||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
// Fail when enabling the renderer. This will happen during the period transition.
|
// Fail when enabling the renderer. This will happen during the period transition.
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalStateException(), ExoPlayerTestRunner.AUDIO_FORMAT);
|
new IllegalStateException(),
|
||||||
|
ExoPlayerTestRunner.AUDIO_FORMAT,
|
||||||
|
PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1582,7 +1584,9 @@ public final class AnalyticsCollectorTest {
|
|||||||
// Fail when rendering the audio stream. This will happen during the period
|
// Fail when rendering the audio stream. This will happen during the period
|
||||||
// transition.
|
// transition.
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalStateException(), ExoPlayerTestRunner.AUDIO_FORMAT);
|
new IllegalStateException(),
|
||||||
|
ExoPlayerTestRunner.AUDIO_FORMAT,
|
||||||
|
PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1617,7 +1621,9 @@ public final class AnalyticsCollectorTest {
|
|||||||
// period transition (as the first time is when enabling the stream initially).
|
// period transition (as the first time is when enabling the stream initially).
|
||||||
if (++streamChangeCount == 2) {
|
if (++streamChangeCount == 2) {
|
||||||
throw createRendererException(
|
throw createRendererException(
|
||||||
new IllegalStateException(), ExoPlayerTestRunner.AUDIO_FORMAT);
|
new IllegalStateException(),
|
||||||
|
ExoPlayerTestRunner.AUDIO_FORMAT,
|
||||||
|
PlaybackException.ERROR_CODE_UNSPECIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user