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:
parent
5ba613dd44
commit
c404e33198
11
sdr_rtlsdr.c
11
sdr_rtlsdr.c
|
@ -265,7 +265,6 @@ void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) {
|
|||
unsigned free_bufs;
|
||||
unsigned block_duration;
|
||||
|
||||
static int was_odd = 0; // paranoia!!
|
||||
static int dropping = 0;
|
||||
static uint64_t sampleCounter = 0;
|
||||
|
||||
|
@ -297,15 +296,7 @@ void rtlsdrCallback(unsigned char *buf, uint32_t len, void *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
if (was_odd) {
|
||||
// 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;
|
||||
slen = len/2; // Drops any trailing odd sample, that's OK
|
||||
|
||||
if (free_bufs == 0 || (dropping && free_bufs < MODES_MAG_BUFFERS/2)) {
|
||||
// FIFO is full. Drop this block.
|
||||
|
|
Loading…
Reference in a new issue