diff --git a/src/data_receiver.h b/src/data_receiver.h index 2e2b22c02..f807d04dd 100644 --- a/src/data_receiver.h +++ b/src/data_receiver.h @@ -70,6 +70,8 @@ class data_receiver : public cancellable_registry { /// Check whether the underlying buffer is empty. This value may be inaccurate. bool empty() { return sample_queue_.empty(); } + std::size_t samples_available() { return sample_queue_.read_available(); } + /// Flush the queue, return the number of dropped samples uint32_t flush() noexcept { return sample_queue_.flush(); } diff --git a/src/stream_inlet_impl.h b/src/stream_inlet_impl.h index d5641d74f..bcb44926a 100644 --- a/src/stream_inlet_impl.h +++ b/src/stream_inlet_impl.h @@ -302,7 +302,7 @@ class stream_inlet_impl { * Query the current size of the buffer, i.e. the number of samples that are buffered. * Note that this value may be inaccurate and should not be relied on for program logic. */ - std::size_t samples_available() { return (std::size_t)(!data_receiver_.empty()); } + std::size_t samples_available() { return data_receiver_.samples_available(); } /// Flush the queue, return the number of dropped samples uint32_t flush() { return data_receiver_.flush(); }