Handle baseband::dma::wait_for_rx_buffer() returning empty buffer.

Was technically OK before, because sample count was zero. But seems silly (and vaguely dangerous) to call all that code with a nullptr.
This commit is contained in:
Jared Boone 2016-01-09 12:20:57 -08:00
parent c3167ac27c
commit 365c2ef946
2 changed files with 18 additions and 12 deletions

View file

@ -98,6 +98,7 @@ void BasebandThread::run() {
while(true) {
// TODO: Place correct sampling rate into buffer returned here:
const auto buffer_tmp = baseband::dma::wait_for_rx_buffer();
if( buffer_tmp ) {
buffer_c8_t buffer {
buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate
};
@ -113,6 +114,7 @@ void BasebandThread::run() {
}
);
}
}
delete baseband_buffer;
}

View file

@ -92,6 +92,10 @@ struct buffer_t {
timestamp { timestamp }
{
}
operator bool() const {
return (p != nullptr);
}
};
#endif/*__BUFFER_H__*/