10#include <catch2/catch_test_macros.hpp>
20 auto const opts =
"{}";
39 auto const frameDurationNs = 1000000000 *
configInfo.common.grainRate.denominator /
configInfo.common.grainRate.numerator;
40 auto writerThread = std::thread{[readerGrainIndex, frameDurationNs,
writer]
42 constexpr auto writerLatencyGrains = 3;
43 for (std::uint64_t writerGrainIndex = readerGrainIndex - writerLatencyGrains; writerGrainIndex <= readerGrainIndex; ++writerGrainIndex)
46 std::uint8_t*
buffer =
nullptr;
49 memcpy(
buffer, &writerGrainIndex,
sizeof(std::uint64_t));
52 if (writerGrainIndex < readerGrainIndex)
60 std::uint8_t*
buffer =
nullptr;
61 constexpr auto oneS = 1000000000;
65 std::uint64_t obtainedGrainIndex = 0;
66 memcpy(&obtainedGrainIndex,
buffer,
sizeof(std::uint64_t));
67 REQUIRE(readerGrainIndex == obtainedGrainIndex);
Public flow reader, writer, payload and synchronization APIs.
MXL_EXPORT mxlStatus mxlFlowWriterOpenGrain(mxlFlowWriter writer, uint64_t index, mxlGrainInfo *mxlGrainInfo, uint8_t **payload)
MXL_EXPORT mxlStatus mxlFlowReaderGetGrain(mxlFlowReader reader, uint64_t index, uint64_t timeoutNs, mxlGrainInfo *grain, uint8_t **payload)
MXL_EXPORT mxlStatus mxlReleaseFlowReader(mxlInstance instance, mxlFlowReader reader)
struct mxlFlowReader_t * mxlFlowReader
struct mxlGrainInfo_t mxlGrainInfo
struct mxlFlowWriter_t * mxlFlowWriter
MXL_EXPORT mxlStatus mxlReleaseFlowWriter(mxlInstance instance, mxlFlowWriter writer)
MXL_EXPORT mxlStatus mxlCreateFlowWriter(mxlInstance instance, char const *flowDef, char const *options, mxlFlowWriter *writer, mxlFlowConfigInfo *configInfo, bool *created)
MXL_EXPORT mxlStatus mxlCreateFlowReader(mxlInstance instance, char const *flowId, char const *options, mxlFlowReader *reader)
MXL_EXPORT mxlStatus mxlFlowWriterCommitGrain(mxlFlowWriter writer, mxlGrainInfo const *grain)
struct mxlFlowConfigInfo_t mxlFlowConfigInfo
MXL_EXPORT mxlStatus mxlDestroyInstance(mxlInstance in_instance)
MXL_EXPORT mxlInstance mxlCreateInstance(char const *in_mxlDomain, char const *in_options)
std::string readFile(std::filesystem::path const &filepath)
uint8_t * buffer
Set a mark at the beginning and the end of the grain payload.
mxlFlowConfigInfo configInfo
mxlGrainInfo gInfo
Open the grain.
TEST_CASE_PERSISTENT_FIXTURE(mxl::tests::mxlDomainFixture, "Video Flow : Wait for grain availability", "[mxl flows timing]")
REQUIRE(timeDelta< 33 '366 '667LL)
MXL_EXPORT void mxlSleepForNs(uint64_t ns)
MXL_EXPORT uint64_t mxlGetCurrentIndex(mxlRational const *editRate)