mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -140,7 +140,7 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
}
|
}
|
||||||
catch(IllegalArgumentException iae)
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.error("no gain control", 5, "Couldn't obtain " +
|
LOGGING_SUPPRESSOR.error("no gain control", 2, "Couldn't obtain " +
|
||||||
"MASTER GAIN control for stereo line [" + mixer.getMixerInfo().getName() + " | " +
|
"MASTER GAIN control for stereo line [" + mixer.getMixerInfo().getName() + " | " +
|
||||||
getChannelName() + "]");
|
getChannelName() + "]");
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
}
|
}
|
||||||
catch(IllegalArgumentException iae)
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.error("no mute control", 5, "Couldn't obtain " +
|
LOGGING_SUPPRESSOR.error("no mute control", 2, "Couldn't obtain " +
|
||||||
"MUTE control for stereo line [" + mixer.getMixerInfo().getName() + " | " +
|
"MUTE control for stereo line [" + mixer.getMixerInfo().getName() + " | " +
|
||||||
getChannelName() + "]");
|
getChannelName() + "]");
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
{
|
{
|
||||||
if(mOutput == null)
|
if(mOutput == null)
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.error("null output", 5, "Audio Output is null - ignoring audio playback request");
|
LOGGING_SUPPRESSOR.error("null output", 2, "Audio Output is null - ignoring audio playback request");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,8 +323,9 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
}
|
}
|
||||||
catch(IllegalArgumentException iae)
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
mLog.warn("Couldn't obtain MASTER GAIN control for stereo line [" +
|
LOGGING_SUPPRESSOR.error("no gain control", 2, "Couldn't obtain " +
|
||||||
mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
|
"MASTER GAIN control for stereo line [" + mMixer.getMixerInfo().getName() + " | " +
|
||||||
|
getChannelName() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -334,23 +335,24 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
}
|
}
|
||||||
catch(IllegalArgumentException iae)
|
catch(IllegalArgumentException iae)
|
||||||
{
|
{
|
||||||
mLog.warn("Couldn't obtain MUTE control for stereo line [" +
|
LOGGING_SUPPRESSOR.error("no mute control", 2, "Couldn't obtain " +
|
||||||
mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
|
"MASTER MUTE control for stereo line [" + mMixer.getMixerInfo().getName() + " | " +
|
||||||
|
getChannelName() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGING_SUPPRESSOR.info("reopen audio output success", 5,
|
LOGGING_SUPPRESSOR.info("reopen audio output success", 2,
|
||||||
"Closed and reopened audio output - success - mOutput is not null");
|
"Closed and reopened audio output - success - mOutput is not null");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.info("reopen audio output fail", 5,
|
LOGGING_SUPPRESSOR.info("reopen audio output fail", 2,
|
||||||
"Closed and reopened audio output - fail - mOutput is null");
|
"Closed and reopened audio output - fail - mOutput is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(LineUnavailableException lue)
|
catch(LineUnavailableException lue)
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.error("reopen fail for lua", 3, "Attempt to reopen " +
|
LOGGING_SUPPRESSOR.error("reopen fail for lua", 2, "Attempt to reopen " +
|
||||||
"audio source data line failed", lue);
|
"audio source data line failed", lue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -393,7 +395,7 @@ public abstract class AudioOutput implements LineListener, Listener<IdentifierUp
|
|||||||
}
|
}
|
||||||
catch(LineUnavailableException e)
|
catch(LineUnavailableException e)
|
||||||
{
|
{
|
||||||
LOGGING_SUPPRESSOR.error("failed reopen source data line lua", 3,
|
LOGGING_SUPPRESSOR.error("failed reopen source data line lua", 2,
|
||||||
"Failed to (re)open the source data line for audio output - mixer [" +
|
"Failed to (re)open the source data line for audio output - mixer [" +
|
||||||
mMixer.getMixerInfo().getName() + "]");
|
mMixer.getMixerInfo().getName() + "]");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
* Copyright (C) 2014-2024 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,11 +35,10 @@ import io.github.dsheirer.source.ISourceEventProvider;
|
|||||||
import io.github.dsheirer.source.SourceEvent;
|
import io.github.dsheirer.source.SourceEvent;
|
||||||
import io.github.dsheirer.source.heartbeat.Heartbeat;
|
import io.github.dsheirer.source.heartbeat.Heartbeat;
|
||||||
import io.github.dsheirer.source.heartbeat.IHeartbeatListener;
|
import io.github.dsheirer.source.heartbeat.IHeartbeatListener;
|
||||||
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class AbstractChannelState extends Module implements IChannelEventProvider, IDecodeEventProvider,
|
public abstract class AbstractChannelState extends Module implements IChannelEventProvider, IDecodeEventProvider,
|
||||||
IDecoderStateEventProvider, ISourceEventProvider, IHeartbeatListener, ISquelchStateProvider,
|
IDecoderStateEventProvider, ISourceEventProvider, IHeartbeatListener, ISquelchStateProvider,
|
||||||
IdentifierUpdateProvider, IOverflowListener
|
IdentifierUpdateProvider, IOverflowListener
|
||||||
@@ -53,7 +52,8 @@ public abstract class AbstractChannelState extends Module implements IChannelEve
|
|||||||
private Channel mChannel;
|
private Channel mChannel;
|
||||||
protected boolean mSourceOverflow = false;
|
protected boolean mSourceOverflow = false;
|
||||||
private HeartbeatReceiver mHeartbeatReceiver = new HeartbeatReceiver();
|
private HeartbeatReceiver mHeartbeatReceiver = new HeartbeatReceiver();
|
||||||
|
protected boolean mTeardownSequenceStarted = false;
|
||||||
|
protected boolean mTeardownSequenceCompleted = false;
|
||||||
|
|
||||||
//TODO: remove the IOverflowListener code from this class
|
//TODO: remove the IOverflowListener code from this class
|
||||||
|
|
||||||
@@ -66,6 +66,22 @@ public abstract class AbstractChannelState extends Module implements IChannelEve
|
|||||||
mChannel = channel;
|
mChannel = channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the teardown sequence was started.
|
||||||
|
*/
|
||||||
|
public boolean isTeardownSequenceCompleted()
|
||||||
|
{
|
||||||
|
return mTeardownSequenceCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the teardown sequence was completed, meaning that the request disable channel event was dispatched.
|
||||||
|
*/
|
||||||
|
public boolean isTeardownSequenceStarted()
|
||||||
|
{
|
||||||
|
return mTeardownSequenceStarted;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates/replaces the current channel configuration with the argument.
|
* Updates/replaces the current channel configuration with the argument.
|
||||||
*/
|
*/
|
||||||
@@ -89,6 +105,11 @@ public abstract class AbstractChannelState extends Module implements IChannelEve
|
|||||||
*/
|
*/
|
||||||
protected abstract void checkState();
|
protected abstract void checkState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if any timeslot is currently in a TEARDOWN state.
|
||||||
|
*/
|
||||||
|
public abstract boolean isTeardownState();
|
||||||
|
|
||||||
public abstract List<ChannelMetadata> getChannelMetadata();
|
public abstract List<ChannelMetadata> getChannelMetadata();
|
||||||
|
|
||||||
public abstract void updateChannelStateIdentifiers(IdentifierUpdateNotification notification);
|
public abstract void updateChannelStateIdentifiers(IdentifierUpdateNotification notification);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
* Copyright (C) 2014-2024 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -44,13 +44,12 @@ import io.github.dsheirer.source.SourceEvent;
|
|||||||
import io.github.dsheirer.source.SourceType;
|
import io.github.dsheirer.source.SourceType;
|
||||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||||
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
|
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multi-Channel state tracks the overall state of all processing modules and decoders configured for the channel
|
* Multi-Channel state tracks the overall state of all processing modules and decoders configured for the channel
|
||||||
@@ -166,6 +165,7 @@ public class MultiChannelState extends AbstractChannelState implements IDecoderS
|
|||||||
mStateMachineMap.get(timeslot).setState(State.IDLE);
|
mStateMachineMap.get(timeslot).setState(State.IDLE);
|
||||||
break;
|
break;
|
||||||
case TEARDOWN:
|
case TEARDOWN:
|
||||||
|
mTeardownSequenceStarted = true;
|
||||||
if(getChannel().isTrafficChannel())
|
if(getChannel().isTrafficChannel())
|
||||||
{
|
{
|
||||||
checkTeardown();
|
checkTeardown();
|
||||||
@@ -206,7 +206,16 @@ public class MultiChannelState extends AbstractChannelState implements IDecoderS
|
|||||||
{
|
{
|
||||||
if(getChannel().isTrafficChannel())
|
if(getChannel().isTrafficChannel())
|
||||||
{
|
{
|
||||||
broadcast(new ChannelEvent(getChannel(), ChannelEvent.Event.REQUEST_DISABLE));
|
try
|
||||||
|
{
|
||||||
|
broadcast(new ChannelEvent(getChannel(), ChannelEvent.Event.REQUEST_DISABLE));
|
||||||
|
}
|
||||||
|
catch(Throwable t)
|
||||||
|
{
|
||||||
|
mLog.error("Error broadcasting shutdown channel event", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
mTeardownSequenceStarted = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -238,6 +247,20 @@ public class MultiChannelState extends AbstractChannelState implements IDecoderS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTeardownState()
|
||||||
|
{
|
||||||
|
for(StateMachine stateMachine: mStateMachineMap.values())
|
||||||
|
{
|
||||||
|
if(stateMachine.getState() == State.TEARDOWN)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates configuration identifiers for the channel name, system, site and alias list name.
|
* Creates configuration identifiers for the channel name, system, site and alias list name.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
* Copyright (C) 2014-2024 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -46,11 +46,10 @@ import io.github.dsheirer.source.SourceEvent;
|
|||||||
import io.github.dsheirer.source.SourceType;
|
import io.github.dsheirer.source.SourceType;
|
||||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||||
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
|
import io.github.dsheirer.source.config.SourceConfigTunerMultipleFrequency;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channel state tracks the overall state of all processing modules and decoders configured for the channel and
|
* Channel state tracks the overall state of all processing modules and decoders configured for the channel and
|
||||||
@@ -163,9 +162,11 @@ public class SingleChannelState extends AbstractChannelState implements IDecoder
|
|||||||
mStateMachine.setState(State.IDLE);
|
mStateMachine.setState(State.IDLE);
|
||||||
break;
|
break;
|
||||||
case TEARDOWN:
|
case TEARDOWN:
|
||||||
|
mTeardownSequenceStarted = true;
|
||||||
if(getChannel().isTrafficChannel())
|
if(getChannel().isTrafficChannel())
|
||||||
{
|
{
|
||||||
broadcast(new ChannelEvent(getChannel(), ChannelEvent.Event.REQUEST_DISABLE));
|
broadcast(new ChannelEvent(getChannel(), ChannelEvent.Event.REQUEST_DISABLE));
|
||||||
|
mTeardownSequenceCompleted = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -175,6 +176,12 @@ public class SingleChannelState extends AbstractChannelState implements IDecoder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTeardownState()
|
||||||
|
{
|
||||||
|
return mStateMachine.getState() == State.TEARDOWN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void checkState()
|
protected void checkState()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -279,15 +279,27 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
|||||||
break;
|
break;
|
||||||
case REQUEST_DISABLE:
|
case REQUEST_DISABLE:
|
||||||
case NOTIFICATION_DELETE:
|
case NOTIFICATION_DELETE:
|
||||||
if(channel != null && channel.isProcessing())
|
if(channel != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stopProcessing(channel);
|
stopProcessing(channel);
|
||||||
}
|
}
|
||||||
catch(ChannelException ce)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
mLog.error("Error stopping channel [" + channel.getName() + "] - " + ce.getMessage());
|
mLog.error("Error stopping channel [" + channel + "]", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Request to disable channel must have non-null channel");
|
||||||
|
}
|
||||||
|
catch(IllegalArgumentException iae)
|
||||||
|
{
|
||||||
|
mLog.error("Caught a [" + event.getEvent() + "] non-standard channel event - logging stack trace. " +
|
||||||
|
"This should not happen, please send this error to the developer.", iae);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -521,7 +533,14 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
|||||||
|
|
||||||
if(addProcessingChain(channel, processingChain))
|
if(addProcessingChain(channel, processingChain))
|
||||||
{
|
{
|
||||||
processingChain.start();
|
try
|
||||||
|
{
|
||||||
|
processingChain.start();
|
||||||
|
}
|
||||||
|
catch(Throwable t)
|
||||||
|
{
|
||||||
|
mLog.error("Error caught during processing chain startup - continuing", t);
|
||||||
|
}
|
||||||
|
|
||||||
if(GraphicsEnvironment.isHeadless())
|
if(GraphicsEnvironment.isHeadless())
|
||||||
{
|
{
|
||||||
@@ -627,8 +646,28 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//This has to be done on the FX event thread when the playlist editor is constructed
|
//When we're in non-headless mode we have to change the processing property on the JavaFX
|
||||||
Platform.runLater(() -> channel.setProcessing(false));
|
//event thread. However, if it hasn't yet been initialized (ie an FX window opened), we'll
|
||||||
|
//get an ISE. In that case, just set the property to false because there won't be any
|
||||||
|
//property listeners being triggered.
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
channel.setProcessing(false);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
mLog.error("Error during channel stop while setting processing to false [" + channel +
|
||||||
|
"] - continuing channel stop process", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch(IllegalStateException e)
|
||||||
|
{
|
||||||
|
channel.setProcessing(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -847,6 +886,10 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
|||||||
mLog.error("Error stopping channel [" + (toShutdown != null ? toShutdown.getName() : "unknown") +
|
mLog.error("Error stopping channel [" + (toShutdown != null ? toShutdown.getName() : "unknown") +
|
||||||
"] with source error - " + ce.getMessage());
|
"] with source error - " + ce.getMessage());
|
||||||
}
|
}
|
||||||
|
catch(Throwable t)
|
||||||
|
{
|
||||||
|
mLog.error("Error stopping channel [" + toShutdown + "]", t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,6 +918,8 @@ public class ChannelProcessingManager implements Listener<ChannelEvent>
|
|||||||
sb.append("\tProcessing Chain - Processing: ").append(chain.isProcessing()).append("\n");
|
sb.append("\tProcessing Chain - Processing: ").append(chain.isProcessing()).append("\n");
|
||||||
AbstractChannelState state = chain.getChannelState();
|
AbstractChannelState state = chain.getChannelState();
|
||||||
sb.append("Channel State: ").append(state.getClass()).append("\n");
|
sb.append("Channel State: ").append(state.getClass()).append("\n");
|
||||||
|
sb.append(" Teardown Started:").append(state.isTeardownSequenceStarted()).append("\n");
|
||||||
|
sb.append(" Teardown Completed:").append(state.isTeardownSequenceCompleted()).append("\n");
|
||||||
for(ChannelMetadata metadata: state.getChannelMetadata())
|
for(ChannelMetadata metadata: state.getChannelMetadata())
|
||||||
{
|
{
|
||||||
sb.append(metadata.getDescription()).append("\n");
|
sb.append(metadata.getDescription()).append("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user