devices: reset internal smart sample buffers upon stop
They are too smart, they keep the timestamps. Change-Id: Idb4b8f03eb5ffdfd6d3fdbc137b20e3ddc4cfa65
This commit is contained in:
parent
1e17c4fb0a
commit
4080eb76f8
|
@ -28,9 +28,9 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
smpl_buf::smpl_buf(size_t len)
|
smpl_buf::smpl_buf(size_t len)
|
||||||
: buf_len(len), time_start(0), time_end(0),
|
: buf_len(len)
|
||||||
data_start(0), data_end(0)
|
|
||||||
{
|
{
|
||||||
|
reset();
|
||||||
data = new uint32_t[len];
|
data = new uint32_t[len];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,14 @@ smpl_buf::~smpl_buf()
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void smpl_buf::reset()
|
||||||
|
{
|
||||||
|
time_start = 0;
|
||||||
|
time_end = 0;
|
||||||
|
data_start = 0;
|
||||||
|
data_end = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t smpl_buf::avail_smpls(TIMESTAMP timestamp) const
|
ssize_t smpl_buf::avail_smpls(TIMESTAMP timestamp) const
|
||||||
{
|
{
|
||||||
if (timestamp < time_start)
|
if (timestamp < time_start)
|
||||||
|
|
|
@ -44,6 +44,10 @@ public:
|
||||||
smpl_buf(size_t len);
|
smpl_buf(size_t len);
|
||||||
~smpl_buf();
|
~smpl_buf();
|
||||||
|
|
||||||
|
/** Reset this buffer, keeps the size
|
||||||
|
*/
|
||||||
|
void reset();
|
||||||
|
|
||||||
/** Query number of samples available for reading
|
/** Query number of samples available for reading
|
||||||
@param timestamp time of first sample
|
@param timestamp time of first sample
|
||||||
@return number of available samples or error
|
@return number of available samples or error
|
||||||
|
|
|
@ -980,6 +980,10 @@ bool IPCDevice::stop()
|
||||||
|
|
||||||
LOGC(DDEV, NOTICE) << "All channels stopped, terminating...";
|
LOGC(DDEV, NOTICE) << "All channels stopped, terminating...";
|
||||||
|
|
||||||
|
/* reset internal buffer timestamps */
|
||||||
|
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||||
|
rx_buffers[i]->reset();
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -750,6 +750,10 @@ bool uhd_device::stop()
|
||||||
async_event_thrd->join();
|
async_event_thrd->join();
|
||||||
delete async_event_thrd;
|
delete async_event_thrd;
|
||||||
|
|
||||||
|
/* reset internal buffer timestamps */
|
||||||
|
for (size_t i = 0; i < rx_buffers.size(); i++)
|
||||||
|
rx_buffers[i]->reset();
|
||||||
|
|
||||||
started = false;
|
started = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue