aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-01-09 20:37:49 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-01-09 20:37:49 +0100
commita31438a0004434c921679b025df271300d3b45dc (patch)
tree57d74930283af8ee7b4900cfc546cc95386bb3bd
parentbe9dfd6f2dcdc7e44bb1400765f7bb225f5a4b40 (diff)
downloadosmo-fl2k-a31438a0004434c921679b025df271300d3b45dc.tar.gz
osmo-fl2k-a31438a0004434c921679b025df271300d3b45dc.tar.bz2
osmo-fl2k-a31438a0004434c921679b025df271300d3b45dc.zip
Fix buffer init in fl2k_tcp interleaved modeHEADinterleaved_rg
-rw-r--r--src/fl2k_tcp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fl2k_tcp.c b/src/fl2k_tcp.c
index c93777b..44d73e7 100644
--- a/src/fl2k_tcp.c
+++ b/src/fl2k_tcp.c
@@ -104,7 +104,8 @@ static void sighandler(int signum)
void fl2k_callback(fl2k_data_info_t *data_info)
{
- int left = FL2K_BUF_LEN;
+ const int required_samples = FL2K_BUF_LEN * (interleaved ? 2 : 1);
+ int left = required_samples;
int received;
int r;
struct timeval tv = { 1, 0 };
@@ -133,7 +134,7 @@ void fl2k_callback(fl2k_data_info_t *data_info)
r = select(sock + 1, &readfds, NULL, NULL, &tv);
if (r) {
- received = recv(sock, txbuf + (FL2K_BUF_LEN - left), left, 0);
+ received = recv(sock, txbuf + (required_samples - left), left, 0);
if (!received) {
fprintf(stderr, "Connection was closed!\n");
fl2k_stop_tx(dev);