Drop odd-count bytes and don't try to account for them later.

In cases where we do get an odd-length buffer (_very_ rare!)
it seems to be more about dropped USB data and not librtlsdr giving
us a partial callback; subsequent callbacks will still be aligned
with the I byte first despite the odd count.
This commit is contained in:
Oliver Jowett 2017-04-02 13:22:11 +01:00
parent 5ba613dd44
commit c404e33198

View file

@ -265,7 +265,6 @@ void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) {
unsigned free_bufs; unsigned free_bufs;
unsigned block_duration; unsigned block_duration;
static int was_odd = 0; // paranoia!!
static int dropping = 0; static int dropping = 0;
static uint64_t sampleCounter = 0; static uint64_t sampleCounter = 0;
@ -297,15 +296,7 @@ void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) {
} }
} }
if (was_odd) { slen = len/2; // Drops any trailing odd sample, that's OK
// Drop a sample so we are in sync with I/Q samples again (hopefully)
++buf;
--len;
++outbuf->dropped;
}
was_odd = (len & 1);
slen = len/2;
if (free_bufs == 0 || (dropping && free_bufs < MODES_MAG_BUFFERS/2)) { if (free_bufs == 0 || (dropping && free_bufs < MODES_MAG_BUFFERS/2)) {
// FIFO is full. Drop this block. // FIFO is full. Drop this block.