11TestVideoSink::TestVideoSink(
bool storeFrames) : m_storeFrames(storeFrames)
13 connect(
this, &QVideoSink::videoFrameChanged,
this, &TestVideoSink::addVideoFrame);
14 connect(
this, &QVideoSink::videoFrameChanged,
this, &TestVideoSink::videoFrameChangedSync);
36void TestVideoSink::setStoreImagesEnabled(
bool storeImages)
39 connect(
this, &QVideoSink::videoFrameChanged,
this, &TestVideoSink::storeImage,
40 Qt::UniqueConnection);
42 disconnect(
this, &QVideoSink::videoFrameChanged,
this, &TestVideoSink::storeImage);
52std::chrono::milliseconds TestVideoSink::durationBetweenFrames(qsizetype frameCount)
54 Q_ASSERT(frameCount > 0);
57 qsizetype framesReceived = 0;
60 connect(
this, &QVideoSink::videoFrameChanged, &context, [&] {
61 if (framesReceived++ == 0)
65 auto allFramesAreReceived = [&]() {
66 return framesReceived > frameCount;
69 using namespace std::chrono;
70 return QTest::qWaitFor(allFramesAreReceived, seconds(10))
71 ? milliseconds(timer.elapsed() / frameCount)