From 9d8875ca567ba03bbc7e3d9be9e7438742ac08a9 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Wed, 4 Jan 2017 23:34:52 -0500 Subject: [PATCH] Make _streaming flag non-gstreamer safe --- src/VideoStreaming/VideoReceiver.cc | 5 +++++ src/VideoStreaming/VideoReceiver.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/VideoStreaming/VideoReceiver.cc b/src/VideoStreaming/VideoReceiver.cc index 55e12df29..1f79dc5de 100644 --- a/src/VideoStreaming/VideoReceiver.cc +++ b/src/VideoStreaming/VideoReceiver.cc @@ -180,6 +180,7 @@ VideoReceiver::VideoReceiver(QObject* parent) : QObject(parent) #if defined(QGC_GST_STREAMING) , _recording(false) + , _streaming(false) , _videoSink(NULL) , _socket(NULL) , _serverPresent(false) @@ -460,6 +461,7 @@ void VideoReceiver::stop() gst_object_unref(_pipeline); _pipeline = NULL; _serverPresent = false; + _streaming = false; } #endif } @@ -494,6 +496,9 @@ void VideoReceiver::_onBusMessage(GstMessage* msg) } while(0); stop(); break; + case GST_MESSAGE_STATE_CHANGED: + _streaming = GST_STATE(_pipeline) == GST_STATE_PLAYING; + break; default: break; } diff --git a/src/VideoStreaming/VideoReceiver.h b/src/VideoStreaming/VideoReceiver.h index 27c78a531..869044d4e 100644 --- a/src/VideoStreaming/VideoReceiver.h +++ b/src/VideoStreaming/VideoReceiver.h @@ -40,7 +40,7 @@ public: #endif bool recording() { return _recording; } - bool streaming() { return GST_STATE(_pipeline) == GST_STATE_PLAYING; } + bool streaming() { return _streaming; } signals: void recordingChanged(); -- 2.22.0