libcamera: base: timer: Drop start() overload with int argument
The start(unsigned int msec) overload is error-prone, as the argument unit can easily be mistaken in callers. Drop it and update all callers to use the start(std::chrono::milliseconds) overload instead. The callers now need to use std::chrono_literals. The using statement could be added to timer.h for convenience, but "using" is discouraged in header files to avoid namespace pollution. Update the callers instead, and while at it, sort the "using" statements alphabetically in tests. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
074fa98ac4
commit
54398c1583
19 changed files with 67 additions and 61 deletions
|
@ -25,7 +25,6 @@ public:
|
||||||
Timer(Object *parent = nullptr);
|
Timer(Object *parent = nullptr);
|
||||||
~Timer();
|
~Timer();
|
||||||
|
|
||||||
void start(unsigned int msec) { start(std::chrono::milliseconds(msec)); }
|
|
||||||
void start(std::chrono::milliseconds duration);
|
void start(std::chrono::milliseconds duration);
|
||||||
void start(std::chrono::steady_clock::time_point deadline);
|
void start(std::chrono::steady_clock::time_point deadline);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
|
@ -62,16 +62,6 @@ Timer::~Timer()
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \fn Timer::start(unsigned int msec)
|
|
||||||
* \brief Start or restart the timer with a timeout of \a msec
|
|
||||||
* \param[in] msec The timer duration in milliseconds
|
|
||||||
*
|
|
||||||
* If the timer is already running it will be stopped and restarted.
|
|
||||||
*
|
|
||||||
* \context This function is \threadbound.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Start or restart the timer with a timeout of \a duration
|
* \brief Start or restart the timer with a timeout of \a duration
|
||||||
* \param[in] duration The timer duration in milliseconds
|
* \param[in] duration The timer duration in milliseconds
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "libcamera/internal/ipc_unixsocket.h"
|
#include "libcamera/internal/ipc_unixsocket.h"
|
||||||
#include "libcamera/internal/process.h"
|
#include "libcamera/internal/process.h"
|
||||||
|
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace libcamera {
|
namespace libcamera {
|
||||||
|
|
||||||
LOG_DECLARE_CATEGORY(IPCPipe)
|
LOG_DECLARE_CATEGORY(IPCPipe)
|
||||||
|
@ -126,7 +128,7 @@ int IPCPipeUnixSocket::call(const IPCUnixSocket::Payload &message,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* \todo Make this less dangerous, see IPCPipe::sendSync() */
|
/* \todo Make this less dangerous, see IPCPipe::sendSync() */
|
||||||
timeout.start(2000);
|
timeout.start(2000ms);
|
||||||
while (!iter->second.done) {
|
while (!iter->second.done) {
|
||||||
if (!timeout.isRunning()) {
|
if (!timeout.isRunning()) {
|
||||||
LOG(IPCPipe, Error) << "Call timeout!";
|
LOG(IPCPipe, Error) << "Call timeout!";
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ protected:
|
||||||
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning())
|
while (timer.isRunning())
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ private:
|
||||||
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start(100);
|
timer.start(100ms);
|
||||||
while (timer.isRunning())
|
while (timer.isRunning())
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ protected:
|
||||||
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
|
||||||
|
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning())
|
while (timer.isRunning())
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
static EventDispatcher *dispatcher;
|
static EventDispatcher *dispatcher;
|
||||||
static bool interrupt;
|
static bool interrupt;
|
||||||
|
@ -50,7 +51,7 @@ protected:
|
||||||
/* Event processing interruption by signal. */
|
/* Event processing interruption by signal. */
|
||||||
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
|
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
|
|
||||||
struct itimerval itimer = {};
|
struct itimerval itimer = {};
|
||||||
itimer.it_value.tv_usec = 500000;
|
itimer.it_value.tv_usec = 500000;
|
||||||
|
@ -69,7 +70,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Event processing interruption. */
|
/* Event processing interruption. */
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
dispatcher->interrupt();
|
dispatcher->interrupt();
|
||||||
|
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
@ -79,7 +80,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
itimer.it_value.tv_usec = 500000;
|
itimer.it_value.tv_usec = 500000;
|
||||||
interrupt = true;
|
interrupt = true;
|
||||||
setitimer(ITIMER_REAL, &itimer, nullptr);
|
setitimer(ITIMER_REAL, &itimer, nullptr);
|
||||||
|
|
|
@ -16,8 +16,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class EventTest : public Test
|
class EventTest : public Test
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.start(100);
|
timeout.start(100ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
timeout.stop();
|
timeout.stop();
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ protected:
|
||||||
/* Test read notification without data. */
|
/* Test read notification without data. */
|
||||||
notified_ = false;
|
notified_ = false;
|
||||||
|
|
||||||
timeout.start(100);
|
timeout.start(100ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
timeout.stop();
|
timeout.stop();
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.start(100);
|
timeout.start(100ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
timeout.stop();
|
timeout.stop();
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ protected:
|
||||||
notified_ = false;
|
notified_ = false;
|
||||||
notifier_->setEnabled(true);
|
notifier_->setEnabled(true);
|
||||||
|
|
||||||
timeout.start(100);
|
timeout.start(100ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
timeout.stop();
|
timeout.stop();
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
#include "camera_test.h"
|
#include "camera_test.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class FenceTest : public CameraTest, public Test
|
class FenceTest : public CameraTest, public Test
|
||||||
{
|
{
|
||||||
|
@ -316,7 +316,7 @@ int FenceTest::run()
|
||||||
|
|
||||||
/* Loop for one second. */
|
/* Loop for one second. */
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && expectedCompletionResult_) {
|
while (timer.isRunning() && expectedCompletionResult_) {
|
||||||
if (completedRequest_ == signalledRequestId_ && setFence_)
|
if (completedRequest_ == signalledRequestId_ && setFence_)
|
||||||
/*
|
/*
|
||||||
|
@ -324,7 +324,7 @@ int FenceTest::run()
|
||||||
* been re-queued with a fence. Start the timer to
|
* been re-queued with a fence. Start the timer to
|
||||||
* signal the fence in 10 msec.
|
* signal the fence in 10 msec.
|
||||||
*/
|
*/
|
||||||
fenceTimer.start(10);
|
fenceTimer.start(10ms);
|
||||||
|
|
||||||
dispatcher_->processEvents();
|
dispatcher_->processEvents();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class HotplugTest : public Test
|
class HotplugTest : public Test
|
||||||
{
|
{
|
||||||
|
@ -88,7 +89,7 @@ protected:
|
||||||
std::ofstream(uvcDriverDir_ + "unbind", std::ios::binary)
|
std::ofstream(uvcDriverDir_ + "unbind", std::ios::binary)
|
||||||
<< uvcDeviceDir;
|
<< uvcDeviceDir;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && !cameraRemoved_)
|
while (timer.isRunning() && !cameraRemoved_)
|
||||||
Thread::current()->eventDispatcher()->processEvents();
|
Thread::current()->eventDispatcher()->processEvents();
|
||||||
if (!cameraRemoved_) {
|
if (!cameraRemoved_) {
|
||||||
|
@ -99,7 +100,7 @@ protected:
|
||||||
/* Bind the camera again and process events. */
|
/* Bind the camera again and process events. */
|
||||||
std::ofstream(uvcDriverDir_ + "bind", std::ios::binary)
|
std::ofstream(uvcDriverDir_ + "bind", std::ios::binary)
|
||||||
<< uvcDeviceDir;
|
<< uvcDeviceDir;
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && !cameraAdded_)
|
while (timer.isRunning() && !cameraAdded_)
|
||||||
Thread::current()->eventDispatcher()->processEvents();
|
Thread::current()->eventDispatcher()->processEvents();
|
||||||
if (!cameraAdded_) {
|
if (!cameraAdded_) {
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class IPAInterfaceTest : public Test, public Object
|
class IPAInterfaceTest : public Test, public Object
|
||||||
{
|
{
|
||||||
|
@ -111,7 +112,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationInit)
|
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationInit)
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ protected:
|
||||||
|
|
||||||
/* Test start of IPA module. */
|
/* Test start of IPA module. */
|
||||||
ipa_->start();
|
ipa_->start();
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationStart)
|
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationStart)
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ protected:
|
||||||
|
|
||||||
/* Test stop of IPA module. */
|
/* Test stop of IPA module. */
|
||||||
ipa_->stop();
|
ipa_->stop();
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationStop)
|
while (timer.isRunning() && trace_ != ipa::vimc::IPAOperationStop)
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
#define CMD_LEN_CMP 3
|
#define CMD_LEN_CMP 3
|
||||||
#define CMD_JOIN 4
|
#define CMD_JOIN 4
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
int calculateLength(int fd)
|
int calculateLength(int fd)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +431,7 @@ private:
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
timeout.start(200);
|
timeout.start(200ms);
|
||||||
while (!callDone_) {
|
while (!callDone_) {
|
||||||
if (!timeout.isRunning()) {
|
if (!timeout.isRunning()) {
|
||||||
cerr << "Call timeout!" << endl;
|
cerr << "Call timeout!" << endl;
|
||||||
|
|
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
static const string message("hello from the child");
|
static const string message("hello from the child");
|
||||||
|
|
||||||
|
@ -80,7 +81,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.start(200);
|
timeout.start(200ms);
|
||||||
while (timeout.isRunning())
|
while (timeout.isRunning())
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class ProcessTestChild
|
class ProcessTestChild
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.start(2000);
|
timeout.start(2000ms);
|
||||||
while (timeout.isRunning() && exitStatus_ == Process::NotExited)
|
while (timeout.isRunning() && exitStatus_ == Process::NotExited)
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class TimeoutHandler : public Object
|
class TimeoutHandler : public Object
|
||||||
{
|
{
|
||||||
|
@ -24,13 +25,13 @@ public:
|
||||||
: timer_(this), timeout_(false)
|
: timer_(this), timeout_(false)
|
||||||
{
|
{
|
||||||
timer_.timeout.connect(this, &TimeoutHandler::timeoutHandler);
|
timer_.timeout.connect(this, &TimeoutHandler::timeoutHandler);
|
||||||
timer_.start(100);
|
timer_.start(100ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart()
|
void restart()
|
||||||
{
|
{
|
||||||
timeout_ = false;
|
timeout_ = false;
|
||||||
timer_.start(100);
|
timer_.start(100ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool timeout() const
|
bool timeout() const
|
||||||
|
|
|
@ -14,8 +14,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class ManagedTimer : public Timer
|
class ManagedTimer : public Timer
|
||||||
{
|
{
|
||||||
|
@ -26,7 +27,7 @@ public:
|
||||||
timeout.connect(this, &ManagedTimer::timeoutHandler);
|
timeout.connect(this, &ManagedTimer::timeoutHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void start(int msec)
|
void start(std::chrono::milliseconds msec)
|
||||||
{
|
{
|
||||||
count_ = 0;
|
count_ = 0;
|
||||||
start_ = std::chrono::steady_clock::now();
|
start_ = std::chrono::steady_clock::now();
|
||||||
|
@ -82,7 +83,7 @@ protected:
|
||||||
ManagedTimer timer2;
|
ManagedTimer timer2;
|
||||||
|
|
||||||
/* Timer expiration. */
|
/* Timer expiration. */
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
|
|
||||||
if (!timer.isRunning()) {
|
if (!timer.isRunning()) {
|
||||||
cout << "Timer expiration test failed" << endl;
|
cout << "Timer expiration test failed" << endl;
|
||||||
|
@ -101,7 +102,7 @@ protected:
|
||||||
* Nanosecond resolution in a 32 bit value wraps at 4.294967
|
* Nanosecond resolution in a 32 bit value wraps at 4.294967
|
||||||
* seconds (0xFFFFFFFF / 1000000)
|
* seconds (0xFFFFFFFF / 1000000)
|
||||||
*/
|
*/
|
||||||
timer.start(4295);
|
timer.start(4295ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
if (timer.hasFailed()) {
|
if (timer.hasFailed()) {
|
||||||
|
@ -110,7 +111,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer restart. */
|
/* Timer restart. */
|
||||||
timer.start(500);
|
timer.start(500ms);
|
||||||
|
|
||||||
if (!timer.isRunning()) {
|
if (!timer.isRunning()) {
|
||||||
cout << "Timer restart test failed" << endl;
|
cout << "Timer restart test failed" << endl;
|
||||||
|
@ -125,9 +126,9 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer restart before expiration. */
|
/* Timer restart before expiration. */
|
||||||
timer.start(50);
|
timer.start(50ms);
|
||||||
timer.start(100);
|
timer.start(100ms);
|
||||||
timer.start(150);
|
timer.start(150ms);
|
||||||
|
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -147,8 +148,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Two timers. */
|
/* Two timers. */
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
timer2.start(300);
|
timer2.start(300ms);
|
||||||
|
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -170,8 +171,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restart timer before expiration. */
|
/* Restart timer before expiration. */
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
timer2.start(300);
|
timer2.start(300ms);
|
||||||
|
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.start(1000);
|
timer.start(1000ms);
|
||||||
|
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
|
@ -194,10 +195,10 @@ protected:
|
||||||
* deleted. This will result in a crash on failure.
|
* deleted. This will result in a crash on failure.
|
||||||
*/
|
*/
|
||||||
ManagedTimer *dyntimer = new ManagedTimer();
|
ManagedTimer *dyntimer = new ManagedTimer();
|
||||||
dyntimer->start(100);
|
dyntimer->start(100ms);
|
||||||
delete dyntimer;
|
delete dyntimer;
|
||||||
|
|
||||||
timer.start(200);
|
timer.start(200ms);
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
|
|
||||||
return TestPass;
|
return TestPass;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "v4l2_videodevice_test.h"
|
#include "v4l2_videodevice_test.h"
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class BufferSharingTest : public V4L2VideoDeviceTest
|
class BufferSharingTest : public V4L2VideoDeviceTest
|
||||||
{
|
{
|
||||||
|
@ -145,7 +146,7 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.start(10000);
|
timeout.start(10000ms);
|
||||||
while (timeout.isRunning()) {
|
while (timeout.isRunning()) {
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
if (framesCaptured_ > 30 && framesOutput_ > 30)
|
if (framesCaptured_ > 30 && framesOutput_ > 30)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "v4l2_videodevice_test.h"
|
#include "v4l2_videodevice_test.h"
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class CaptureAsyncTest : public V4L2VideoDeviceTest
|
class CaptureAsyncTest : public V4L2VideoDeviceTest
|
||||||
{
|
{
|
||||||
|
@ -60,7 +61,7 @@ protected:
|
||||||
if (ret)
|
if (ret)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
timeout.start(10000);
|
timeout.start(10000ms);
|
||||||
while (timeout.isRunning()) {
|
while (timeout.isRunning()) {
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
if (frames > 30)
|
if (frames > 30)
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
using namespace std;
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
class V4L2M2MDeviceTest : public Test
|
class V4L2M2MDeviceTest : public Test
|
||||||
{
|
{
|
||||||
|
@ -155,7 +156,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer timeout;
|
Timer timeout;
|
||||||
timeout.start(5000);
|
timeout.start(5000ms);
|
||||||
while (timeout.isRunning()) {
|
while (timeout.isRunning()) {
|
||||||
dispatcher->processEvents();
|
dispatcher->processEvents();
|
||||||
if (captureFrames_ > 30)
|
if (captureFrames_ > 30)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue