use of com.google.android.exoplayer2.transformer.TransformationException in project ExoPlayer by google.
the class TransformerEndToEndTest method startTransformation_withAudioDecoderFormatUnsupported_completesWithError.
@Test
public void startTransformation_withAudioDecoderFormatUnsupported_completesWithError() throws Exception {
Transformer transformer = createTransformerBuilder().setTransformationRequest(new TransformationRequest.Builder().setAudioMimeType(// supported by encoder and muxer
MimeTypes.AUDIO_AAC).build()).build();
MediaItem mediaItem = MediaItem.fromUri(URI_PREFIX + FILE_AUDIO_UNSUPPORTED_BY_DECODER);
transformer.startTransformation(mediaItem, outputPath);
TransformationException exception = TransformerTestRunner.runUntilError(transformer);
assertThat(exception).hasCauseThat().isInstanceOf(IllegalArgumentException.class);
assertThat(exception.errorCode).isEqualTo(TransformationException.ERROR_CODE_DECODING_FORMAT_UNSUPPORTED);
}
use of com.google.android.exoplayer2.transformer.TransformationException in project ExoPlayer by google.
the class TransformerEndToEndTest method startTransformation_withMultipleListeners_callsEachOnError.
@Test
public void startTransformation_withMultipleListeners_callsEachOnError() throws Exception {
Transformer.Listener mockListener1 = mock(Transformer.Listener.class);
Transformer.Listener mockListener2 = mock(Transformer.Listener.class);
Transformer.Listener mockListener3 = mock(Transformer.Listener.class);
Transformer transformer = createTransformerBuilder().addListener(mockListener1).addListener(mockListener2).addListener(mockListener3).setTransformationRequest(new TransformationRequest.Builder().setAudioMimeType(MimeTypes.AUDIO_AAC).build()).build();
MediaItem mediaItem = MediaItem.fromUri(URI_PREFIX + FILE_AUDIO_UNSUPPORTED_BY_DECODER);
transformer.startTransformation(mediaItem, outputPath);
TransformationException exception = TransformerTestRunner.runUntilError(transformer);
verify(mockListener1, times(1)).onTransformationError(mediaItem, exception);
verify(mockListener2, times(1)).onTransformationError(mediaItem, exception);
verify(mockListener3, times(1)).onTransformationError(mediaItem, exception);
}
use of com.google.android.exoplayer2.transformer.TransformationException in project ExoPlayer by google.
the class TransformerEndToEndTest method startTransformation_withAudioEncoderFormatUnsupported_completesWithError.
@Test
public void startTransformation_withAudioEncoderFormatUnsupported_completesWithError() throws Exception {
Transformer transformer = createTransformerBuilder().setTransformationRequest(new TransformationRequest.Builder().setAudioMimeType(// unsupported by encoder, supported by muxer
MimeTypes.AUDIO_AMR_NB).build()).build();
MediaItem mediaItem = MediaItem.fromUri(URI_PREFIX + FILE_AUDIO_UNSUPPORTED_BY_MUXER);
transformer.startTransformation(mediaItem, outputPath);
TransformationException exception = TransformerTestRunner.runUntilError(transformer);
assertThat(exception).hasCauseThat().isInstanceOf(IllegalArgumentException.class);
assertThat(exception.errorCode).isEqualTo(TransformationException.ERROR_CODE_OUTPUT_FORMAT_UNSUPPORTED);
}
Aggregations