mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 04:55:55 -05:00
Resolves issue with residual buffer decimation processing after dispose
is invoked on call teardown.
This commit is contained in:
@@ -264,6 +264,7 @@ public class TunerChannelSource extends ComplexSource
|
||||
public class DecimationProcessor implements Runnable
|
||||
{
|
||||
private AtomicBoolean mDispose = new AtomicBoolean( false );
|
||||
private List<ComplexBuffer> mSampleBuffers = new ArrayList<ComplexBuffer>();
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
@@ -278,22 +279,11 @@ public class TunerChannelSource extends ComplexSource
|
||||
* run the program out of memory */
|
||||
try
|
||||
{
|
||||
/* Check to see if we've been shutdown */
|
||||
if( mDispose.get() )
|
||||
{
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<ComplexBuffer> sampleBuffers =
|
||||
new ArrayList<ComplexBuffer>();
|
||||
|
||||
if( mBuffer != null )
|
||||
{
|
||||
mBuffer.drainTo( sampleBuffers, 4 );
|
||||
mBuffer.drainTo( mSampleBuffers, 4 );
|
||||
|
||||
for( Buffer buffer: sampleBuffers )
|
||||
for( Buffer buffer: mSampleBuffers )
|
||||
{
|
||||
/* Check to see if we've been shutdown */
|
||||
if( mDispose.get() )
|
||||
@@ -329,13 +319,24 @@ public class TunerChannelSource extends ComplexSource
|
||||
}
|
||||
}
|
||||
|
||||
sampleBuffers.clear();
|
||||
}
|
||||
mSampleBuffers.clear();
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
mLog.error( "encountered an error during decimation process", e );
|
||||
/* Only log the stack trace if we've haven't been shutdown and
|
||||
* this is a true error */
|
||||
if( !mDispose.get() )
|
||||
{
|
||||
mLog.error( "Error encountered during decimation process", e );
|
||||
}
|
||||
}
|
||||
|
||||
/* Check to see if we've been shutdown */
|
||||
if( mDispose.get() )
|
||||
{
|
||||
mSampleBuffers.clear();
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user