mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -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,
|
||||||
@@ -414,11 +414,13 @@ public class USBTransferProcessor implements TransferCallback
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
{
|
||||||
|
mFilledBuffers.drainTo(mBuffersToDispatch, 50);
|
||||||
|
|
||||||
|
while(!mBuffersToDispatch.isEmpty())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mFilledBuffers.drainTo(mBuffersToDispatch, 15);
|
|
||||||
|
|
||||||
for(byte[] buffer : mBuffersToDispatch)
|
for(byte[] buffer : mBuffersToDispatch)
|
||||||
{
|
{
|
||||||
float[] complexSamples = mSampleAdapter.convert(buffer);
|
float[] complexSamples = mSampleAdapter.convert(buffer);
|
||||||
@@ -432,6 +434,8 @@ public class USBTransferProcessor implements TransferCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
mBuffersToDispatch.clear();
|
mBuffersToDispatch.clear();
|
||||||
|
mFilledBuffers.drainTo(mBuffersToDispatch, 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user