MPT1327: Fix for call timeout setting not being honored (#823)

* MPT1327: Fix for call timeout setting not being honored
This commit is contained in:
Andrzej Pańkowski
2020-05-21 11:14:50 +02:00
committed by GitHub
parent 8167e9e9f2
commit e1194d26bd
9 changed files with 78 additions and 35 deletions

View File

@@ -226,15 +226,19 @@ public class DecoderFactory
ChannelMap channelMap = channelMapModel.getChannelMap(mptConfig.getChannelMapName());
Sync sync = mptConfig.getSync();
modules.add(new MPT1327Decoder(sync));
modules.add(new AudioModule(aliasList));
final int timeout = mptConfig.getCallTimeout() * 1000;
// Set max segment audio sample length slightly above call timeout to
// not create a new segment if the processing chain finishes a bit after
// actual call timeout.
modules.add(new AudioModule(aliasList, timeout + 5000));
SourceType sourceType = channel.getSourceConfiguration().getSourceType();
if(sourceType == SourceType.TUNER || sourceType == SourceType.TUNER_MULTIPLE_FREQUENCIES)
{
modules.add(new FMDemodulatorModule(FM_CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
}
long timeout = mptConfig.getCallTimeout() * 1000;
if(channelType == ChannelType.STANDARD)
{
MPT1327TrafficChannelManager trafficChannelManager = new MPT1327TrafficChannelManager(channel, channelMap);

View File

@@ -55,7 +55,7 @@ public abstract class DecodeConfiguration extends Configuration
{
public static final int DEFAULT_CALL_TIMEOUT_DELAY_SECONDS = 45;
public static final int CALL_TIMEOUT_MINIMUM = 1;
public static final int CALL_TIMEOUT_MAXIMUM = 300; //5 minutes
public static final int CALL_TIMEOUT_MAXIMUM = 180;
public static final int TRAFFIC_CHANNEL_LIMIT_DEFAULT = 3;
public static final int TRAFFIC_CHANNEL_LIMIT_MINIMUM = 0;

View File

@@ -0,0 +1,34 @@
/*
*
* * ******************************************************************************
* * Copyright (C) 2014-2020 Dennis Sheirer
* *
* * 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
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <http://www.gnu.org/licenses/>
* * *****************************************************************************
*
*
*/
package io.github.dsheirer.module.decode.config;
/**
* Trait of decoder configurations that support providing information about call timeout.
*/
public interface WithCallTimeout
{
/**
* @return call timeout in seconds
*/
int getCallTimeout();
}

View File

@@ -25,9 +25,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import io.github.dsheirer.module.decode.config.WithCallTimeout;
import io.github.dsheirer.source.tuner.channel.ChannelSpecification;
public class DecodeConfigMPT1327 extends DecodeConfiguration
public class DecodeConfigMPT1327 extends DecodeConfiguration implements WithCallTimeout
{
private String mChannelMapName;
private Sync mSync = Sync.NORMAL;
@@ -74,7 +75,7 @@ public class DecodeConfigMPT1327 extends DecodeConfiguration
}
/**
* Sets the call timeout value in seconds ( 10 - 600 );
* Sets the call timeout value in seconds ( 1 - 180 );
*
* @param timeout
*/

View File

@@ -32,7 +32,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
{
private P25P1Decoder.Modulation mModulation = P25P1Decoder.Modulation.C4FM;
private int mCallTimeout = 1;
private int mTrafficChannelPoolSize = TRAFFIC_CHANNEL_LIMIT_DEFAULT;
private boolean mIgnoreDataCalls = false;
@@ -68,28 +67,6 @@ public class DecodeConfigP25Phase1 extends DecodeConfiguration
mIgnoreDataCalls = ignore;
}
/**
* Note: this field is now deprecated.
*
* @return
*/
@JsonIgnore
@Deprecated
public int getCallTimeout()
{
return mCallTimeout;
}
/**
* Sets the call timeout value in seconds ( 10 - 600 );
*
* @param timeout
*/
@Deprecated
public void setCallTimeout(int timeout)
{
}
@JacksonXmlProperty(isAttribute = true, localName = "traffic_channel_pool_size")
public int getTrafficChannelPoolSize()