if (encoding != C.ENCODING_PCM_16BIT) { maybeReleaseGvrAudioSurround(); throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); break; default: throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
new Object[]{RENDERER_DECODER, AUDIO_SINK_INITIALISATION_ERROR, createRenderer(new AudioSink.InitializationException(0, 0, 0, 0))}, new Object[]{RENDERER_DECODER, AUDIO_SINK_WRITE_ERROR, createRenderer(new AudioSink.WriteException(0))}, new Object[]{RENDERER_DECODER, AUDIO_UNHANDLED_FORMAT_ERROR, createRenderer(new AudioProcessor.UnhandledFormatException(0, 0, 0))}, new Object[]{RENDERER_DECODER, AUDIO_DECODER_ERROR, createRenderer(new AudioDecoderException("audio-decoder-exception"))}, new Object[]{RENDERER_DECODER, INITIALISATION_ERROR, createRenderer(new MediaCodecRenderer.DecoderInitializationException(Format.createSampleFormat("id", "sample-mimety[e", 0), new Throwable(), true, 0))},
@Override public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding) throws UnhandledFormatException { boolean outputChannelsChanged = !Arrays.equals(pendingOutputChannels, outputChannels); outputChannels = pendingOutputChannels; if (outputChannels == null) { active = false; return outputChannelsChanged; } if (encoding != C.ENCODING_PCM_16BIT) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } if (!outputChannelsChanged && this.sampleRateHz == sampleRateHz && this.channelCount == channelCount) { return false; } this.sampleRateHz = sampleRateHz; this.channelCount = channelCount; active = channelCount != outputChannels.length; for (int i = 0; i < outputChannels.length; i++) { int channelIndex = outputChannels[i]; if (channelIndex >= channelCount) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } active |= (channelIndex != i); } return true; }
@Override public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding) throws UnhandledFormatException { if (encoding != OUTPUT_ENCODING) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } if (endBufferSize > 0) { trimmedFrameCount += endBufferSize / bytesPerFrame; } this.channelCount = channelCount; this.sampleRateHz = sampleRateHz; bytesPerFrame = Util.getPcmFrameSize(OUTPUT_ENCODING, channelCount); endBuffer = new byte[trimEndFrames * bytesPerFrame]; endBufferSize = 0; pendingTrimStartBytes = trimStartFrames * bytesPerFrame; boolean wasActive = isActive; isActive = trimStartFrames != 0 || trimEndFrames != 0; receivedInputSinceConfigure = false; return wasActive != isActive; }
@Override public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding) throws UnhandledFormatException { if (encoding != C.ENCODING_PCM_16BIT) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } int outputSampleRateHz = pendingOutputSampleRateHz == SAMPLE_RATE_NO_CHANGE ? sampleRateHz : pendingOutputSampleRateHz; if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount && this.outputSampleRateHz == outputSampleRateHz) { return false; } this.sampleRateHz = sampleRateHz; this.channelCount = channelCount; this.outputSampleRateHz = outputSampleRateHz; sonic = null; return true; }
@Override public boolean configure(int sampleRateHz, int channelCount, @C.Encoding int encoding) throws UnhandledFormatException { if (encoding != C.ENCODING_PCM_8BIT && encoding != C.ENCODING_PCM_16BIT && encoding != C.ENCODING_PCM_24BIT && encoding != C.ENCODING_PCM_32BIT) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount && this.encoding == encoding) { return false; } this.sampleRateHz = sampleRateHz; this.channelCount = channelCount; this.encoding = encoding; return true; }
@Override public boolean configure(int sampleRateHz, int channelCount, @C.Encoding int encoding) throws UnhandledFormatException { if (!Util.isEncodingHighResolutionIntegerPcm(encoding)) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount && sourceEncoding == encoding) { return false; } this.sampleRateHz = sampleRateHz; this.channelCount = channelCount; sourceEncoding = encoding; return true; }
@Override public boolean configure(int sampleRateHz, int channelCount, int encoding) throws UnhandledFormatException { if (encoding != C.ENCODING_PCM_16BIT) { throw new UnhandledFormatException(sampleRateHz, channelCount, encoding); } if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount) { return false; } this.sampleRateHz = sampleRateHz; this.channelCount = channelCount; bytesPerFrame = channelCount * 2; return true; }