/** * Wait until all the frames from the frame buffer have been consumed. Keeps the buffering thread alive to keep it * interruptible for seeking until buffer is empty. * * @throws InterruptedException When interrupted externally (or for seek/stop). */ public void waitOnEnd() throws InterruptedException { frameBuffer.setTerminateOnEmpty(); frameBuffer.waitForTermination(); }
@Override public void stop() { frameBuffer.lockBuffer(); frameBuffer.setTerminateOnEmpty(); frameBuffer.clear(); markerTracker.trigger(STOPPED); remoteNodeManager.onTrackEnd(null, track, AudioTrackEndReason.STOPPED); }
log.debug("Track {} was interrupted outside of execution loop.", audioTrack.getIdentifier()); } else { frameBuffer.setTerminateOnEmpty();
private void handleTrackFrameData(TrackFrameDataMessage message) throws Exception { RemoteAudioTrackExecutor executor = playingTracks.get(message.executorId); if (executor != null) { if (message.seekedPosition >= 0) { executor.clearSeek(message.seekedPosition); } AudioFrameBuffer buffer = executor.getAudioBuffer(); executor.receivedData(); AudioDataFormat format = executor.getConfiguration().getOutputFormat(); for (AudioFrame frame : message.frames) { buffer.consume(new ImmutableAudioFrame(frame.getTimecode(), frame.getData(), frame.getVolume(), format)); } if (message.finished) { buffer.setTerminateOnEmpty(); trackEnded(executor, false); } } }