Currently all tests use ROC_CLOCK_SOURCE_INTERNAL. With this setting, writing to sender and reading from receiver are blocking operations, and they automatically sleep necessary amount of time before proceeding to next chunk, according to configured sample rate.
With CLOCK_SOURCE_EXTERNAL, write and read becomes non-blocking, and the user is responsible for invoking these operations at appropriate time.
We need to add a new flag (say, FlagExternalClock) that will be handled by init_config(), test::Sender and test::Receiver. With this flag, init_config() will set CLOCK_SOURCE_EXTERNAL option to configs, and test::Sender and test::Receiver will sleep according to sample rate before invoking roc_sender_write or roc_receiver_read.
E.g., if sample rate is 44100, sender should ensure that it writes samples at speed 44100 samples per second. E.g., if it writes chunks of 100 samples, it should perform each write once per 1000 / 441 ~ 2.2ms.
Then we need to add new test, say, clock_external, to test_sender_receiver.cpp, that will run sender and receiver with this new flag.
Add integration tests for C API for
CLOCK_SOURCE_EXTERNAL
.Current tests: https://github.com/roc-streaming/roc-toolkit/blob/develop/src/tests/public_api/test_sender_receiver.cpp API documentation: https://roc-streaming.org/toolkit/docs/api.html
Currently all tests use
ROC_CLOCK_SOURCE_INTERNAL
. With this setting, writing to sender and reading from receiver are blocking operations, and they automatically sleep necessary amount of time before proceeding to next chunk, according to configured sample rate.With
CLOCK_SOURCE_EXTERNAL
, write and read becomes non-blocking, and the user is responsible for invoking these operations at appropriate time.We need to add a new flag (say, FlagExternalClock) that will be handled by init_config(), test::Sender and test::Receiver. With this flag, init_config() will set
CLOCK_SOURCE_EXTERNAL
option to configs, and test::Sender and test::Receiver will sleep according to sample rate before invoking roc_sender_write or roc_receiver_read.E.g., if sample rate is 44100, sender should ensure that it writes samples at speed 44100 samples per second. E.g., if it writes chunks of 100 samples, it should perform each write once per 1000 / 441 ~ 2.2ms.
Then we need to add new test, say,
clock_external
, totest_sender_receiver.cpp
, that will run sender and receiver with this new flag.Background: #328.