Fix latency timers not getting started/stopped
In a previous commit, we start/stop these timers based on number of ports tracking stream stats triggered by RPCs. However, timers cannot be triggered across threads (RPC thread and main thread in this case). This fix uses a queued connection to post it to the other queue.
This commit is contained in:
parent
649fa03575
commit
4ba98cc520
@ -200,11 +200,13 @@ void AbstractPort::addNote(QString note)
|
||||
|
||||
bool AbstractPort::setTrackStreamStats(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
streamTiming_->start(id());
|
||||
else
|
||||
streamTiming_->stop(id());
|
||||
|
||||
// XXX: This function is called by modify() in context of the RPC
|
||||
// thread (1 thread per connected client), but the StreamTiming
|
||||
// singleton resides in the main thread and its' start/stop methods
|
||||
// start/stop timers which cannot be done across Qt Threads. Hence
|
||||
// this slightly hacky way of invoking those methods
|
||||
QMetaObject::invokeMethod(streamTiming_, enable ? "start" : "stop",
|
||||
Qt::QueuedConnection, Q_ARG(uint, id()));
|
||||
data_.set_is_tracking_stream_stats(enable);
|
||||
|
||||
return true;
|
||||
|
@ -33,10 +33,6 @@ class StreamTiming : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
void start(uint portId);
|
||||
void stop(uint portId);
|
||||
|
||||
bool recordTxTime(uint portId, uint guid, uint ttagId,
|
||||
const struct timespec ×tamp);
|
||||
bool recordRxTime(uint portId, uint guid, uint ttagId,
|
||||
@ -52,6 +48,10 @@ public:
|
||||
|
||||
static StreamTiming* instance();
|
||||
|
||||
public slots:
|
||||
void start(uint portId);
|
||||
void stop(uint portId);
|
||||
|
||||
private:
|
||||
StreamTiming(QObject *parent=nullptr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user