Resolved issue with wave recorders not shutting down correctly, causing

errors with max file handles is exceeded.
This commit is contained in:
denny
2015-12-11 21:33:20 -05:00
parent ee96ce43ad
commit 98c70a1b12
2 changed files with 9 additions and 10 deletions

View File

@@ -72,8 +72,8 @@ public class RecorderManager implements Listener<AudioPacket>
} }
else if( audioPacket.getType() == AudioPacket.Type.END ) else if( audioPacket.getType() == AudioPacket.Type.END )
{ {
mRecorders.remove( identifier ); RealBufferWaveRecorder finished = mRecorders.remove( identifier );
recorder.stop(); finished.stop();
} }
} }
else if( audioPacket.getType() == AudioPacket.Type.AUDIO ) else if( audioPacket.getType() == AudioPacket.Type.AUDIO )

View File

@@ -125,11 +125,10 @@ public class RealBufferWaveRecorder extends Module
public void stop() public void stop()
{ {
if( mRunning.compareAndSet( true, false ) ) /* Signal the buffer processor to end with a poison pill */
{ receive( new PoisonPill() );
/* Signal the buffer processor to end with a poison pill */
receive( new PoisonPill() ); mRunning.set( false );
}
} }
@Override @Override
@@ -191,7 +190,6 @@ public class RealBufferWaveRecorder extends Module
try try
{ {
mWriter.close(); mWriter.close();
mWriter = null;
} }
catch( IOException io ) catch( IOException io )
{ {
@@ -200,11 +198,12 @@ public class RealBufferWaveRecorder extends Module
} }
} }
mFile = null;
mThreadPoolManager.cancel( mProcessorHandle ); mThreadPoolManager.cancel( mProcessorHandle );
mWriter = null;
mFile = null;
mProcessorHandle = null; mProcessorHandle = null;
mThreadPoolManager = null;
} }
else else
{ {