/** * @return An immutable instance created from this mutable audio frame. In an ideal flow, this should never be called. */ public ImmutableAudioFrame freeze() { return new ImmutableAudioFrame(timecode, getData(), volume, format); } }
@Override public void consume(AudioFrame frame) throws InterruptedException { // If an interrupt sent along with setting the stopping status was silently consumed elsewhere, this check should // still trigger. Guarantees that stopped tracks cannot get stuck in this method. Possible performance improvement: // offer with timeout, check stopping if timed out, then put? if (stopping != null && stopping.get()) { throw new InterruptedException(); } if (!locked) { receivedFrames = true; if (clearOnInsert) { audioFrames.clear(); clearOnInsert = false; } if (frame instanceof AbstractMutableAudioFrame) { frame = ((AbstractMutableAudioFrame) frame).freeze(); } audioFrames.put(frame); } }