private void decodeFrame() { if (!mp4.hasMoreFrames()) { buffer.close(); return; } try { final AudioFrame frame = mp4.readNextFrame(); if (frame == null) { buffer.close(); return; } decoder.decodeFrame(frame.getData(), sampleBuffer); } catch (IOException e) { buffer.close(); return; } }
MP4AudioInputStream(InputStream in, AudioFormat format, long length) throws IOException { super(in, format, length); mp4 = new MP4Reader(in); final DecoderConfig conf = DecoderConfig.parseMP4DecoderSpecificInfo(mp4.getDecoderSpecificInfo()); decoder = new Decoder(conf); sampleBuffer = new SampleBuffer(); }