lib: change default number of transfers to 15

So far we had 32 * 256KB which was a bit overkill,
15 are more than enough.

15 was chosen instead of 16 because at least on Linux
there seems to be a system-wide limit of 63 transfers
(when they are 256KB large), so 4 dongles can be used
on a single machine without lowering the default transfer
number.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
master
Steve Markgraf 11 years ago
parent 5b0137abaf
commit 89f73b183f
  1. 5
      include/rtl-sdr.h
  2. 2
      src/librtlsdr.c
  3. 4
      src/rtl_fm.c
  4. 3
      src/rtl_sdr.c
  5. 2
      src/rtl_tcp.c
  6. 3
      src/rtl_test.c

@ -351,9 +351,10 @@ RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, v
* \param cb callback function to return received samples * \param cb callback function to return received samples
* \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 (15)
* \param buf_len optional buffer length, must be multiple of 512, * \param buf_len optional buffer length, must be multiple of 512,
* set to 0 for default buffer length (16 * 32 * 512) * should be a multiple of 16384 (URB size), 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,

@ -338,7 +338,7 @@ static rtlsdr_dongle_t known_devices[] = {
{ 0x1f4d, 0xd803, "PROlectrix DV107669" }, { 0x1f4d, 0xd803, "PROlectrix DV107669" },
}; };
#define DEFAULT_BUF_NUMBER 32 #define DEFAULT_BUF_NUMBER 15
#define DEFAULT_BUF_LENGTH (16 * 32 * 512) #define DEFAULT_BUF_LENGTH (16 * 32 * 512)
#define DEF_RTL_XTAL_FREQ 28800000 #define DEF_RTL_XTAL_FREQ 28800000

@ -76,7 +76,6 @@
#include "convenience/convenience.h" #include "convenience/convenience.h"
#define DEFAULT_SAMPLE_RATE 24000 #define DEFAULT_SAMPLE_RATE 24000
#define DEFAULT_ASYNC_BUF_NUMBER 32
#define DEFAULT_BUF_LENGTH (1 * 16384) #define DEFAULT_BUF_LENGTH (1 * 16384)
#define MAXIMUM_OVERSAMPLE 16 #define MAXIMUM_OVERSAMPLE 16
#define MAXIMUM_BUF_LENGTH (MAXIMUM_OVERSAMPLE * DEFAULT_BUF_LENGTH) #define MAXIMUM_BUF_LENGTH (MAXIMUM_OVERSAMPLE * DEFAULT_BUF_LENGTH)
@ -807,8 +806,7 @@ static void rtlsdr_callback(unsigned char *buf, uint32_t len, void *ctx)
static void *dongle_thread_fn(void *arg) static void *dongle_thread_fn(void *arg)
{ {
struct dongle_state *s = arg; struct dongle_state *s = arg;
rtlsdr_read_async(s->dev, rtlsdr_callback, s, rtlsdr_read_async(s->dev, rtlsdr_callback, s, 0, s->buf_len);
DEFAULT_ASYNC_BUF_NUMBER, s->buf_len);
return 0; return 0;
} }

@ -35,7 +35,6 @@
#include "convenience/convenience.h" #include "convenience/convenience.h"
#define DEFAULT_SAMPLE_RATE 2048000 #define DEFAULT_SAMPLE_RATE 2048000
#define DEFAULT_ASYNC_BUF_NUMBER 32
#define DEFAULT_BUF_LENGTH (16 * 16384) #define DEFAULT_BUF_LENGTH (16 * 16384)
#define MINIMAL_BUF_LENGTH 512 #define MINIMAL_BUF_LENGTH 512
#define MAXIMAL_BUF_LENGTH (256 * 16384) #define MAXIMAL_BUF_LENGTH (256 * 16384)
@ -261,7 +260,7 @@ int main(int argc, char **argv)
} else { } else {
fprintf(stderr, "Reading samples in async mode...\n"); fprintf(stderr, "Reading samples in async mode...\n");
r = rtlsdr_read_async(dev, rtlsdr_callback, (void *)file, r = rtlsdr_read_async(dev, rtlsdr_callback, (void *)file,
DEFAULT_ASYNC_BUF_NUMBER, out_block_size); 0, out_block_size);
} }
if (do_exit) if (do_exit)

@ -92,7 +92,7 @@ void usage(void)
"\t[-f frequency to tune to [Hz]]\n" "\t[-f frequency to tune to [Hz]]\n"
"\t[-g gain (default: 0 for auto)]\n" "\t[-g gain (default: 0 for auto)]\n"
"\t[-s samplerate in Hz (default: 2048000 Hz)]\n" "\t[-s samplerate in Hz (default: 2048000 Hz)]\n"
"\t[-b number of buffers (default: 32, set by library)]\n" "\t[-b number of buffers (default: 15, set by library)]\n"
"\t[-n max number of linked list buffers to keep (default: 500)]\n" "\t[-n max number of linked list buffers to keep (default: 500)]\n"
"\t[-d device index (default: 0)]\n" "\t[-d device index (default: 0)]\n"
"\t[-P ppm_error (default: 0)]\n"); "\t[-P ppm_error (default: 0)]\n");

@ -44,7 +44,6 @@
#include "convenience/convenience.h" #include "convenience/convenience.h"
#define DEFAULT_SAMPLE_RATE 2048000 #define DEFAULT_SAMPLE_RATE 2048000
#define DEFAULT_ASYNC_BUF_NUMBER 32
#define DEFAULT_BUF_LENGTH (16 * 16384) #define DEFAULT_BUF_LENGTH (16 * 16384)
#define MINIMAL_BUF_LENGTH 512 #define MINIMAL_BUF_LENGTH 512
#define MAXIMAL_BUF_LENGTH (256 * 16384) #define MAXIMAL_BUF_LENGTH (256 * 16384)
@ -406,7 +405,7 @@ int main(int argc, char **argv)
} else { } else {
fprintf(stderr, "Reading samples in async mode...\n"); fprintf(stderr, "Reading samples in async mode...\n");
r = rtlsdr_read_async(dev, rtlsdr_callback, NULL, r = rtlsdr_read_async(dev, rtlsdr_callback, NULL,
DEFAULT_ASYNC_BUF_NUMBER, out_block_size); 0, out_block_size);
} }
if (do_exit) { if (do_exit) {

Loading…
Cancel
Save