Skip to content

samples_available does not return the number of samples, only 1 or 0. #97

@cboulay

Description

@cboulay

According to the docstring, samples_available() is supposed to return the number of samples in the buffer.

/**
* 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()); }

But it returns (std::size_t)(!data_receiver_.empty());, and data_receiver_.empty() returns a boolean sample_queue_.empty();

bool empty() { return sample_queue_.empty(); }

So samples_available() will only ever return 0 or 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions