From 0cebe7e5d9ed4330dca504f3097eff388e7927e3 Mon Sep 17 00:00:00 2001 From: Denny Date: Mon, 26 Dec 2016 13:48:24 -0500 Subject: [PATCH] #30 - cleanup --- src/audio/broadcast/AudioBroadcaster.java | 8 ++- .../v1/ShoutcastV1AudioBroadcaster.java | 41 --------------- .../v2/ShoutcastV2AudioBroadcaster.java | 50 ------------------- 3 files changed, 7 insertions(+), 92 deletions(-) diff --git a/src/audio/broadcast/AudioBroadcaster.java b/src/audio/broadcast/AudioBroadcaster.java index 2fd41747..44b7a0f8 100644 --- a/src/audio/broadcast/AudioBroadcaster.java +++ b/src/audio/broadcast/AudioBroadcaster.java @@ -277,7 +277,13 @@ public abstract class AudioBroadcaster implements IAudioPacketListener if(!connected()) { - mAudioRecordingQueue.clear(); + StreamableAudioRecording recording = mAudioRecordingQueue.poll(); + + while(recording != null) + { + removeRecording(recording); + recording = mAudioRecordingQueue.poll(); + } } } } diff --git a/src/audio/broadcast/shoutcast/v1/ShoutcastV1AudioBroadcaster.java b/src/audio/broadcast/shoutcast/v1/ShoutcastV1AudioBroadcaster.java index 9653ae51..39aadf79 100644 --- a/src/audio/broadcast/shoutcast/v1/ShoutcastV1AudioBroadcaster.java +++ b/src/audio/broadcast/shoutcast/v1/ShoutcastV1AudioBroadcaster.java @@ -331,45 +331,4 @@ public class ShoutcastV1AudioBroadcaster extends AudioBroadcaster } } } - - - public static void main(String[] args) - { - ShoutcastV1Configuration config = new ShoutcastV1Configuration(BroadcastFormat.MP3); - config.setName("Test Configuration"); - config.setHost("localhost"); - config.setPort(8000); - config.setPassword("denny3:#1"); - config.setStreamName("Denny's Audio Broadcast Test"); - config.setGenre("Scanner Audio"); - config.setPublic(true); - config.setURL("http://localhost:8000"); - config.setBitRate(16); - - ThreadPoolManager threadPoolManager = new ThreadPoolManager(); - - final AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(threadPoolManager,config); - - Path path = Paths.get("/home/denny/Music/PCM.wav"); - mLog.debug("Opening: " + path.toString()); - - mLog.debug("Registering and starting audio playback"); - - while(true) - { - mLog.debug("Playback started [" + path.toString() + "]"); - - try (AudioPacketMonoWaveReader reader = new AudioPacketMonoWaveReader(path, true)) - { - reader.setListener(audioBroadcaster); - reader.read(); - } - catch (IOException e) - { - mLog.error("Error", e); - } - - mLog.debug("Playback ended [" + path.toString() + "]"); - } - } } diff --git a/src/audio/broadcast/shoutcast/v2/ShoutcastV2AudioBroadcaster.java b/src/audio/broadcast/shoutcast/v2/ShoutcastV2AudioBroadcaster.java index 2310bff8..bbc97b3a 100644 --- a/src/audio/broadcast/shoutcast/v2/ShoutcastV2AudioBroadcaster.java +++ b/src/audio/broadcast/shoutcast/v2/ShoutcastV2AudioBroadcaster.java @@ -512,54 +512,4 @@ public class ShoutcastV2AudioBroadcaster extends AudioBroadcaster return null; } - - - public static void main(String[] args) - { - boolean test = false; - - ShoutcastV2Configuration config = new ShoutcastV2Configuration(BroadcastFormat.MP3); - config.setStreamID(1); - config.setName("Test Configuration"); - config.setHost("localhost"); - config.setPort(8000); - config.setPassword("denny3"); - config.setStreamName("Denny's Audio Broadcast Test"); - config.setGenre("Public Safety"); - config.setPublic(true); - config.setURL("http://localhost:8000"); - config.setBitRate(16); - - if(test) - { - } - else - { - ThreadPoolManager threadPoolManager = new ThreadPoolManager(); - - final AudioBroadcaster audioBroadcaster = BroadcastFactory.getBroadcaster(threadPoolManager,config); - - Path path = Paths.get("/home/denny/Music/PCM.wav"); - mLog.debug("Opening: " + path.toString()); - - mLog.debug("Registering and starting audio playback"); - - while(true) - { - mLog.debug("Playback started [" + path.toString() + "]"); - - try (AudioPacketMonoWaveReader reader = new AudioPacketMonoWaveReader(path, true)) - { - reader.setListener(audioBroadcaster); - reader.read(); - } - catch (IOException e) - { - mLog.error("Error", e); - } - - mLog.debug("Playback ended [" + path.toString() + "]"); - } - } - } }