libbladeRF: Fixed #128.

Do not assert in the callback stream, but output some warning messages
in case the sample stream does not have a valid integer number of samples.
This commit is contained in:
Brian Padalino 2013-10-05 12:59:33 -04:00
commit 75ef559cb7

View file

@ -1777,13 +1777,18 @@ static void LIBUSB_CALL lusb_stream_cb(struct libusb_transfer *transfer)
else if( stream->state == STREAM_RUNNING ) {
/* Call user callback requesting more data to transmit */
assert(transfer->length == transfer->actual_length);
if (transfer->length != transfer->actual_length) {
log_warning( "Received short transfer\n" );
if ((transfer->actual_length & 3) != 0) {
log_warning( "Fractional samples received - stream likely corrupt\n" );
}
}
next_buffer = stream->cb(
stream->dev,
stream,
&metadata,
transfer->buffer,
bytes_to_c16_samples(transfer->length),
bytes_to_c16_samples(transfer->actual_length),
stream->user_data
);
if( next_buffer == NULL ) {