rtlsdr_read_async: buffer length must be multiple of 512

This commit is contained in:
Dimitri Stolnikov 2012-04-22 21:47:00 +02:00
parent 7ba990981b
commit e4fef23874
2 changed files with 4 additions and 4 deletions

View File

@ -86,8 +86,8 @@ RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, v
* \param ctx user specific context to pass via the callback function * \param ctx user specific context to pass via the callback function
* \param buf_num optional buffer count, buf_num * buf_len = overall buffer size * \param buf_num optional buffer count, buf_num * buf_len = overall buffer size
* set to 0 for default buffer count (32) * set to 0 for default buffer count (32)
* \param buf_len optional buffer length, must be multiple of 2, * \param buf_len optional buffer length, must be multiple of 512,
* set to 0 for default buffer length (16 * 16384) * set to 0 for default buffer length (16 * 32 * 512)
* \return 0 on success * \return 0 on success
*/ */
RTLSDR_API int rtlsdr_read_async(rtlsdr_dev_t *dev, RTLSDR_API int rtlsdr_read_async(rtlsdr_dev_t *dev,

View File

@ -141,7 +141,7 @@ static rtlsdr_device_t devices[] = {
}; };
#define DEFAULT_BUF_NUMBER 32 #define DEFAULT_BUF_NUMBER 32
#define DEFAULT_BUF_LENGTH (16 * 16384) #define DEFAULT_BUF_LENGTH (16 * 32 * 512)
enum rtlsdr_async_status { enum rtlsdr_async_status {
RTLSDR_INACTIVE = 0, RTLSDR_INACTIVE = 0,
@ -891,7 +891,7 @@ int rtlsdr_read_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx,
else else
dev->xfer_buf_num = DEFAULT_BUF_NUMBER; dev->xfer_buf_num = DEFAULT_BUF_NUMBER;
if (buf_len > 0 && buf_len % 2 == 0) /* len must be multiple of 2 */ if (buf_len > 0 && buf_len % 512 == 0) /* len must be multiple of 512 */
dev->xfer_buf_len = buf_len; dev->xfer_buf_len = buf_len;
else else
dev->xfer_buf_len = DEFAULT_BUF_LENGTH; dev->xfer_buf_len = DEFAULT_BUF_LENGTH;