Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes: direct buffer API #13

Merged
merged 2 commits into from
Jul 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion SoapyFCDPP/SoapyFCDPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -330,7 +337,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
Expand Down