mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 09:37:36 -05:00
Merge pull request #253 from DSheirer/252-usb-transfer-processor-bad-logging
252 USB transfer processor erroneous logging and performance enhancements
This commit is contained in:
@@ -124,10 +124,6 @@ public class OverflowableTransferQueue<E>
|
|||||||
mQueue.clear();
|
mQueue.clear();
|
||||||
mCounter.set(0);
|
mCounter.set(0);
|
||||||
mOverflow.set(false);
|
mOverflow.set(false);
|
||||||
if(mOverflowListener != null)
|
|
||||||
{
|
|
||||||
mOverflowListener.sourceOverflow(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class USBTransferProcessor implements TransferCallback
|
|||||||
private static final int TRANSFER_BUFFER_POOL_SIZE = 16;
|
private static final int TRANSFER_BUFFER_POOL_SIZE = 16;
|
||||||
|
|
||||||
//Maximum number of filled buffers for the blocking queue
|
//Maximum number of filled buffers for the blocking queue
|
||||||
private static final int FILLED_BUFFER_MAX_CAPACITY = 300;
|
private static final int FILLED_BUFFER_MAX_CAPACITY = 500;
|
||||||
|
|
||||||
//Threshold for resetting buffer overflow condition
|
//Threshold for resetting buffer overflow condition
|
||||||
private static final int FILLED_BUFFER_OVERFLOW_RESET_THRESHOLD = 100;
|
private static final int FILLED_BUFFER_OVERFLOW_RESET_THRESHOLD = 100;
|
||||||
@@ -200,7 +200,7 @@ public class USBTransferProcessor implements TransferCallback
|
|||||||
|
|
||||||
|
|
||||||
//Unregister from LibUSB processor so that it auto-stops LibUSB processing
|
//Unregister from LibUSB processor so that it auto-stops LibUSB processing
|
||||||
TunerManager.LIBUSB_TRANSFER_PROCESSOR.registerTransferProcessor(this);
|
TunerManager.LIBUSB_TRANSFER_PROCESSOR.unregisterTransferProcessor(this);
|
||||||
|
|
||||||
//Directly invoke the timeout handler to ensure that our cancelled transfer buffers are flushed.
|
//Directly invoke the timeout handler to ensure that our cancelled transfer buffers are flushed.
|
||||||
int result = LibUsb.handleEventsTimeoutCompleted(null, USB_TIMEOUT_MS,
|
int result = LibUsb.handleEventsTimeoutCompleted(null, USB_TIMEOUT_MS,
|
||||||
@@ -415,23 +415,27 @@ public class USBTransferProcessor implements TransferCallback
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
try
|
mFilledBuffers.drainTo(mBuffersToDispatch, 50);
|
||||||
{
|
|
||||||
mFilledBuffers.drainTo(mBuffersToDispatch, 15);
|
|
||||||
|
|
||||||
for(byte[] buffer : mBuffersToDispatch)
|
while(!mBuffersToDispatch.isEmpty())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
float[] complexSamples = mSampleAdapter.convert(buffer);
|
for(byte[] buffer : mBuffersToDispatch)
|
||||||
|
{
|
||||||
|
float[] complexSamples = mSampleAdapter.convert(buffer);
|
||||||
|
|
||||||
mComplexBufferBroadcaster.broadcast(new ComplexBuffer(complexSamples));
|
mComplexBufferBroadcaster.broadcast(new ComplexBuffer(complexSamples));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
mLog.error(mDeviceName + " - error while dispatching complex IQ buffer samples", e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
mLog.error(mDeviceName + " - error while dispatching complex IQ buffer samples", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
mBuffersToDispatch.clear();
|
mBuffersToDispatch.clear();
|
||||||
|
mFilledBuffers.drainTo(mBuffersToDispatch, 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user