Compare commits

...

8 Commits

Author SHA1 Message Date
Denny
0e321bdaa3 Updates build to 0.3.2 (final) 2017-12-02 03:25:41 -05:00
Denny Sheirer
f191d28c98 Merge pull request #295 from DSheirer/241-lj1200-error-check-to-0-3-2-branch
241 LJ1200 Error Correction (v0.3.2 branch)
2017-12-02 03:19:12 -05:00
Denny
afc3d299b6 #241 Resolves issue with error correction routine introducing invalid messages
(cherry picked from commit 910a08f)
2017-12-02 03:18:12 -05:00
Denny
0471d90b54 Updates build to 0.3.2 Beta #3 2017-11-23 07:32:24 -05:00
Denny
8f68967b6c #289 resolves issue with encrypting username and password with XTEA
algorithm using credential values longer than 8 characters/bytes.

(cherry picked from commit 1ddc0a3)
2017-11-23 07:31:52 -05:00
Denny
91b950c13d Updates build version to 0.3.2-beta2 2017-11-04 09:42:27 -04:00
Denny
581ff9f449 Updates CHANGELOG
(cherry picked from commit 64688a3)
2017-11-04 09:41:36 -04:00
Denny
67c3cb9639 Issue #283
Updates Icecast TCP broadcaster to correctly handle content type:text/html
message that normally follows mount point in use error received from
broadcastify.

Changes mount point in use broadcast state to be a temporary error so that
the stream will attempt to reconnect after receiving this error.

Updates logging to include memory allocation/usage metrics with each
logging entry in order to support debugging issues related to high
memory usage situations.  Updates initial application logging to better
identify the host system operating environment.

(cherry picked from commit 8be3399)
2017-11-04 09:41:23 -04:00
9 changed files with 116 additions and 48 deletions

View File

@@ -1,5 +1,13 @@
0.3.2 20171105
- Resolves issue with tuner frequency adjustments that was causing channel processing
to lockup and show persistent 'overflow' state in each channel status
- Resolves issue with broadcastify 'mountpoint-in-use' error handling and updates
memory usage logging
0.3.0-beta1 20170129
0.3.1 20171009
- Resolves Java 9 incompatibility issues
0.3.0 20170922
- REQUIRES: Java 8 (or newer) for compatibility and eventual changeover to JavaFX
- FEATURE: audio streaming - adds capability to stream to multiple remote broadcast
servers (Broadcastify, Icecast v2.3 and v2.4+, and Shoutcast V1 and V2). Each

View File

@@ -7,7 +7,7 @@
<property name="major" value="0"/>
<property name="minor" value="3"/>
<property name="patch" value="2"/>
<property name="release" value="-beta1"/>
<property name="release" value=""/>
<property name="filename" value="sdrtrunk_${major}.${minor}.${patch}${release}"/>
<!-- Build properties -->

View File

@@ -1,4 +1,6 @@
<configuration>
<conversionRule conversionWord="memory_usage" converterClass="util.MemoryUsageLogger" />
<timestamp key="appstart" datePattern="HHmmss"/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
@@ -9,7 +11,7 @@
<maxHistory>10</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%-25(%d{yyyyMMdd HHmmss.SSS} [%thread]) %-5level %logger{30} - %msg%n</pattern>
<pattern>%-25(%d{yyyyMMdd HHmmss.SSS} [%thread]) %-5level %logger{30} - %msg %memory_usage%n</pattern>
</encoder>
</appender>
@@ -19,7 +21,7 @@
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%-12(%d{HH:mm:ss.SSS}) %-5level %logger{25} - %msg%n</pattern>
<pattern>%-12(%d{HH:mm:ss.SSS}) %-5level %logger{25} - %msg %memory_usage%n</pattern>
</encoder>
</appender>

View File

@@ -68,7 +68,7 @@ public enum BroadcastState
/**
* Specified mount point is already in use
*/
MOUNT_POINT_IN_USE("Mount Point In Use", true),
MOUNT_POINT_IN_USE("Mount Point In Use", false),
/**
* Server is not known or reachable

View File

@@ -325,6 +325,10 @@ public class IcecastTCPAudioBroadcaster extends IcecastAudioBroadcaster
{
setBroadcastState(BroadcastState.MOUNT_POINT_IN_USE);
}
else if(message.contains("Content-Type: text/html"))
{
//Disregard ... this normally follows the mount point in use error
}
else if(message.contains("Invalid Password") ||
message.contains("Authentication Required"))
{

View File

@@ -71,6 +71,40 @@ public class AuthenticateBroadcast extends UltravoxMessage
setPayload(sb.toString());
}
/**
* Encrypts the value using the XTEA block cipher algorithm. The byte array is sliced into 8-byte chunks and each
* chunk is encrypted into a 16 hexadecimal character string. All encrypted chunks are concatenated and returned
* as a single string. If the value byte array is not an even multiple of 8 characters, it will be padded with
* zero valued bytes to make it an even multiple of eight.
*
* @param xtea instance of the XTEA algorithm with a loaded encryption key
* @param value to encode
* @return value encrypted into one or more multiples of 16 hexadecimal characters
*/
private static String encrypt(XTEA xtea, byte[] value)
{
if(value.length % 8 != 0 || value.length == 0)
{
int newLength = ((value.length / 8) + 1) * 8;
value = Arrays.copyOf(value, newLength);
}
StringBuilder sb = new StringBuilder();
for(int x = 0; x < value.length; x += 8)
{
byte[] plaintext = Arrays.copyOfRange(value, x, x + 8);
byte[] encrypted = xtea.encrypt(plaintext);
for(byte b: encrypted)
{
sb.append(String.format("%02x", b));
}
}
return sb.toString();
}
/**
* Encrypts the value using the XTEA block cipher algorithm and returns the encrypted value as a 16 hex value
*
@@ -80,23 +114,6 @@ public class AuthenticateBroadcast extends UltravoxMessage
*/
private static String encrypt(XTEA xtea, String value)
{
byte[] valueBytes = value.getBytes();
if(valueBytes.length % 8 != 0 || valueBytes.length == 0)
{
int newLength = ((valueBytes.length / 8) + 1) * 8;
valueBytes = Arrays.copyOf(valueBytes, newLength);
}
byte[] encrypted = xtea.encrypt(valueBytes);
StringBuilder sb = new StringBuilder();
for(byte b: encrypted)
{
sb.append(String.format("%02x", b));
}
return sb.toString();
return encrypt(xtea, value.getBytes());
}
}

View File

@@ -163,7 +163,7 @@ public class CRCLJ
}
/**
* Identifies 1 or 2 bit error positions that match the checksum error value.
* Identifies 1 bit error positions that match the checksum error value.
*/
public static int[] findBitErrors( int checksumError )
{
@@ -180,24 +180,6 @@ public class CRCLJ
}
}
/* Two bit errors */
for( int x = 0; x < 48; x++ )
{
for( int y = 0; y < 48; y++ )
{
if( x != y &&
( CHECKSUMS[ x ] ^ CHECKSUMS[ y ] ) == checksumError )
{
int[] errors = new int[ 2 ];
errors[ 0 ] = x;
errors[ 1 ] = y;
return errors;
}
}
}
return null;
}

View File

@@ -33,6 +33,7 @@ import icon.IconManager;
import map.MapService;
import module.log.EventLogManager;
import net.miginfocom.swing.MigLayout;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import playlist.PlaylistManager;
@@ -80,16 +81,16 @@ public class SDRTrunk implements Listener<TunerEvent>
public SDRTrunk()
{
mLog.info("");
mLog.info("*******************************************************************");
mLog.info("**** sdrtrunk: a trunked radio and digital decoding application ***");
mLog.info("**** website: https://github.com/dsheirer/sdrtrunk ***");
mLog.info("*******************************************************************");
mLog.info("");
mLog.info("Host CPU Cores: " + Runtime.getRuntime().availableProcessors());
mLog.info("Host Memory Total: " + Runtime.getRuntime().totalMemory());
mLog.info("Host Memory Max: " + Runtime.getRuntime().maxMemory());
mLog.info("Host Memory Free: " + Runtime.getRuntime().freeMemory());
mLog.info("Memory Logging Format: [Used/Allocated PercentUsed%]");
mLog.info("Host CPU Cores: " + Runtime.getRuntime().availableProcessors());
mLog.info("Host OS Name: " + System.getProperty("os.name"));
mLog.info("Host OS Arch: " + System.getProperty("os.arch"));
mLog.info("Host OS Version: " + System.getProperty("os.version"));
mLog.info("Host Max Java Memory: " + FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()));
//Setup the application home directory
Path home = getHomePath();

View File

@@ -0,0 +1,54 @@
/*******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 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 util;
import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import org.apache.commons.io.FileUtils;
/**
* Custom logging plugin for logging memory usage with logback
*
* Add the following to the logback.xml configuration file to use this custom converter:
*
* <conversionRule conversionWord="memory_usage" converterClass="util.MemoryUsageLogger" />
*
* Update the encoder pattern to include %memory_usage within the pattern
*/
public class MemoryUsageLogger extends ClassicConverter
{
@Override
public String convert(ILoggingEvent iLoggingEvent)
{
//Method argument is ignored - we simply return memory usage statistics
long allocated = Runtime.getRuntime().totalMemory();
long free = Runtime.getRuntime().freeMemory();
long used = allocated - free;
int usedPercentage = (int)((double)(used) / (double)allocated * 100.0);
StringBuilder sb = new StringBuilder();
sb.append("[").append(FileUtils.byteCountToDisplaySize(used).replace(" ", ""));
sb.append("/").append(FileUtils.byteCountToDisplaySize(allocated).replace(" ", ""));
sb.append(" ").append(usedPercentage).append("%]");
return sb.toString();
}
}