Out of memory fixes and updates to the P25 decoder.

Memory Fixes
Decreased the decimation process repeat timing so that it runs smaller work chunks more often
Decreased scheduled thread pool to 2 hot threads
Wrapped all scheduled thread pool runnables in try/catch blocks so that an exception doesn't kill the sample buffer processing thread and cause the buffer to grow unbounded.

P25 updates
Moved TSBK crc checks into the message framer so that message corrections don't occur after the message is constructed.
Added more functionality to the channel state for handling registrations and call events.
This commit is contained in:
dennis.sheirer
2014-12-19 23:59:38 +00:00
parent 63eaef664b
commit ba053457bd
18 changed files with 758 additions and 214 deletions

View File

@@ -1,11 +1,13 @@
package decode.p25.message.tsbk;
import alias.Alias;
import alias.AliasList;
import bits.BitSetBuffer;
import decode.p25.message.tsbk.osp.control.IdentifierUpdate;
import decode.p25.message.tsbk.osp.control.IdentifierUpdateReceiver;
import decode.p25.reference.DataUnitID;
public abstract class GroupMultiChannelGrant extends ChannelGrant
implements IdentifierUpdateReceiver
{
public static final int[] CHANNEL_ID_1 = { 80,81,82,83 };
public static final int[] CHANNEL_NUMBER_1 = { 84,85,86,87,
@@ -17,6 +19,9 @@ public abstract class GroupMultiChannelGrant extends ChannelGrant
112,113,114,115,116,117,118,119 };
public static final int[] GROUP_ADDRESS_2 = { 120,121,122,123,124,125,126,
127,128,129,130,131,132,133,134,135 };
private IdentifierUpdate mIdentifierUpdate1;
private IdentifierUpdate mIdentifierUpdate2;
public GroupMultiChannelGrant( BitSetBuffer message,
DataUnitID duid,
@@ -37,11 +42,14 @@ public abstract class GroupMultiChannelGrant extends ChannelGrant
sb.append( " GRP1:" );
sb.append( getGroupAddress1() );
sb.append( " CHAN2:" );
sb.append( getChannelID2() + "/" + getChannelNumber2() );
sb.append( " GRP2:" );
sb.append( getGroupAddress2() );
if( hasChannelNumber2() )
{
sb.append( " CHAN2:" );
sb.append( getChannelID2() + "/" + getChannelNumber2() );
sb.append( " GRP2:" );
sb.append( getGroupAddress2() );
}
return sb.toString();
}
@@ -76,6 +84,11 @@ public abstract class GroupMultiChannelGrant extends ChannelGrant
return mMessage.getHex( GROUP_ADDRESS_2, 4 );
}
public boolean hasChannelNumber2()
{
return mMessage.getInt( GROUP_ADDRESS_2 ) > 0;
}
@Override
public String getFromID()
{
@@ -87,4 +100,59 @@ public abstract class GroupMultiChannelGrant extends ChannelGrant
{
return getGroupAddress2();
}
@Override
public void setIdentifierMessage( int identifier, IdentifierUpdate message )
{
if( identifier == getChannelID1() )
{
mIdentifierUpdate1 = message;
}
if( hasChannelNumber2() && identifier == getChannelID2() )
{
mIdentifierUpdate2 = message;
}
}
@Override
public int[] getIdentifiers()
{
int[] identifiers;
if( hasChannelNumber2() )
{
identifiers = new int[ 2 ];
identifiers[ 0 ] = getChannelID1();
identifiers[ 1 ] = getChannelID2();
}
else
{
identifiers = new int[ 1 ];
identifiers[ 0 ] = getChannelID1();
}
return identifiers;
}
public long getDownlinkFrequency1()
{
return calculateDownlink( mIdentifierUpdate1, getChannel() );
}
public long getUplinkFrequency1()
{
return calculateUplink( mIdentifierUpdate1, getChannel() );
}
public long getDownlinkFrequency2()
{
return calculateDownlink( mIdentifierUpdate2, getChannel() );
}
public long getUplinkFrequency2()
{
return calculateUplink( mIdentifierUpdate2, getChannel() );
}
}

View File

@@ -36,15 +36,10 @@ public class TSBKMessage extends P25Message
public TSBKMessage( BitSetBuffer message, DataUnitID duid, AliasList aliasList )
{
super( message, duid, aliasList );
checkCRC();
}
protected void checkCRC()
{
mCRC = new CRC[ 1 ];
mCRC[ 0 ] = CRCP25.correctCCITT80( mMessage, MESSAGE_START, CRC_START );
/* Since CRC is checked before construction, mark it as passed */
mCRC = new CRC[ 1 ];
mCRC[ 0 ] = CRC.PASSED;
}
public boolean isLastBlock()

View File

@@ -18,6 +18,6 @@ public class GroupVoiceChannelGrantUpdate extends GroupMultiChannelGrant
@Override
public String getEventType()
{
return Opcode.GROUP_VOICE_CHANNEL_GRANT.getDescription();
return Opcode.GROUP_VOICE_CHANNEL_GRANT_UPDATE.getDescription();
}
}

View File

@@ -3,7 +3,6 @@ package decode.p25.message.tsbk.osp.voice;
import java.util.ArrayList;
import java.util.List;
import alias.Alias;
import alias.AliasList;
import bits.BitSetBuffer;
import decode.p25.message.tsbk.TSBKMessage;
@@ -34,6 +33,12 @@ public class TelephoneInterconnectAnswerRequest extends TSBKMessage
super( message, duid, aliasList );
}
@Override
public String getEventType()
{
return Opcode.TELEPHONE_INTERCONNECT_ANSWER_REQUEST.getDescription();
}
public String getMessage()
{
StringBuilder sb = new StringBuilder();
@@ -72,12 +77,6 @@ public class TelephoneInterconnectAnswerRequest extends TSBKMessage
return mMessage.getHex( TARGET_ADDRESS, 6 );
}
@Override
public String getEventType()
{
return Opcode.TELEPHONE_INTERCONNECT_ANSWER_REQUEST.getDescription();
}
@Override
public String getToID()
{