From 2118f9b5581780a494a4ed7f9ae00761df970b41 Mon Sep 17 00:00:00 2001 From: Phil Ashby Date: Sun, 25 Jul 2021 23:28:35 +0100 Subject: [PATCH 1/2] bug fix: add correct offset to direct buffer pointer --- SoapyFCDPP/SoapyFCDPP.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoapyFCDPP/SoapyFCDPP.cpp b/SoapyFCDPP/SoapyFCDPP.cpp index ab4efb6..1b158b2 100644 --- a/SoapyFCDPP/SoapyFCDPP.cpp +++ b/SoapyFCDPP/SoapyFCDPP.cpp @@ -330,7 +330,7 @@ int SoapyFCDPP::acquireReadBuffer(SoapySDR::Stream *stream, SoapySDR_logf(SOAPY_SDR_ERROR, "snd_pcm_mmap_begin error: %s", snd_strerror(err)); goto retry; } - buffs[0] = ((char *)area->addr) + d_mmap_offset; + buffs[0] = ((char *)area->addr) + d_mmap_offset * 4; // ensure API contract for handle (unused by us) handle = 0; // record mmap is valid From 48c3d8193ac769bd0a9015d4216302029e1d30a7 Mon Sep 17 00:00:00 2001 From: Phil Ashby Date: Sun, 25 Jul 2021 23:46:43 +0100 Subject: [PATCH 2/2] bug fix: prepare restarted stream --- SoapyFCDPP/SoapyFCDPP.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SoapyFCDPP/SoapyFCDPP.cpp b/SoapyFCDPP/SoapyFCDPP.cpp index 1b158b2..edbe212 100644 --- a/SoapyFCDPP/SoapyFCDPP.cpp +++ b/SoapyFCDPP/SoapyFCDPP.cpp @@ -306,6 +306,13 @@ int SoapyFCDPP::acquireReadBuffer(SoapySDR::Stream *stream, // check we are in a valid state (prepared, running or xrun) snd_pcm_state_t state = snd_pcm_state(d_pcm_handle); switch (state) { + case SND_PCM_STATE_SETUP: + SoapySDR_log(SOAPY_SDR_TRACE, "..acquireReadBuffer:preparing"); + if((err = snd_pcm_prepare(d_pcm_handle)) < 0) { + // could not prepare + SoapySDR_logf(SOAPY_SDR_ERROR, "snd_pcm_prepare %s", snd_strerror(err)); + break; + } // fallthrough case SND_PCM_STATE_PREPARED: SoapySDR_log(SOAPY_SDR_TRACE, "..acquireReadBuffer:starting"); err = snd_pcm_start(d_pcm_handle);