Browse Source

VideoReceiver: call stop and cleanup teeProbe

This fixes regular segfaults on exit for me.

Signed-off-by: Julian Oes <julian@oes.ch>
QGC4.4
Julian Oes 2 years ago committed by Philipp Borgers
parent
commit
17249ef600
  1. 12
      src/VideoReceiver/GstVideoReceiver.cc
  2. 4
      src/VideoReceiver/GstVideoReceiver.h

12
src/VideoReceiver/GstVideoReceiver.cc

@ -63,6 +63,7 @@ GstVideoReceiver::GstVideoReceiver(QObject* parent) @@ -63,6 +63,7 @@ GstVideoReceiver::GstVideoReceiver(QObject* parent)
GstVideoReceiver::~GstVideoReceiver(void)
{
stop();
_slotHandler.shutdown();
}
@ -122,7 +123,7 @@ GstVideoReceiver::start(const QString& uri, unsigned timeout, int buffer) @@ -122,7 +123,7 @@ GstVideoReceiver::start(const QString& uri, unsigned timeout, int buffer)
_lastSourceFrameTime = 0;
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, _teeProbe, this, nullptr);
_teeProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, _teeProbe, this, nullptr);
gst_object_unref(pad);
pad = nullptr;
@ -287,6 +288,15 @@ GstVideoReceiver::stop(void) @@ -287,6 +288,15 @@ GstVideoReceiver::stop(void)
qCDebug(VideoReceiverLog) << "Stopping" << _uri;
if (_teeProbeId != 0) {
GstPad* sinkpad;
if ((sinkpad = gst_element_get_static_pad(_tee, "sink")) != nullptr) {
gst_pad_remove_probe(sinkpad, _teeProbeId);
sinkpad = nullptr;
}
_teeProbeId = 0;
}
if (_pipeline != nullptr) {
GstBus* bus;

4
src/VideoReceiver/GstVideoReceiver.h

@ -148,7 +148,9 @@ protected: @@ -148,7 +148,9 @@ protected:
qint64 _lastSourceFrameTime;
qint64 _lastVideoFrameTime;
bool _resetVideoSink;
gulong _videoSinkProbeId;
gulong _videoSinkProbeId = 0;
gulong _teeProbeId = 0;
QTimer _watchdogTimer;

Loading…
Cancel
Save