Commit e7381f6c authored by Patrick J.P's avatar Patrick J.P Committed by Patrick José Pereira

VideoReceiver: Correct start and stop video functions

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent ab2c2726
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
// Override from QGCTool // Override from QGCTool
void setToolbox (QGCToolbox *toolbox); void setToolbox (QGCToolbox *toolbox);
Q_INVOKABLE void startVideo() {_videoReceiver->stop();}; Q_INVOKABLE void startVideo() {_videoReceiver->start();};
Q_INVOKABLE void stopVideo() {_videoReceiver->stop();}; Q_INVOKABLE void stopVideo() {_videoReceiver->stop();};
signals: signals:
......
...@@ -218,6 +218,7 @@ VideoReceiver::start() ...@@ -218,6 +218,7 @@ VideoReceiver::start()
return; return;
} }
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
_stop = false;
qCDebug(VideoReceiverLog) << "start()"; qCDebug(VideoReceiverLog) << "start()";
if (_uri.isEmpty()) { if (_uri.isEmpty()) {
...@@ -433,6 +434,7 @@ void ...@@ -433,6 +434,7 @@ void
VideoReceiver::stop() VideoReceiver::stop()
{ {
#if defined(QGC_GST_STREAMING) #if defined(QGC_GST_STREAMING)
_stop = true;
qCDebug(VideoReceiverLog) << "stop()"; qCDebug(VideoReceiverLog) << "stop()";
if(!_streaming) { if(!_streaming) {
_shutdownPipeline(); _shutdownPipeline();
...@@ -870,9 +872,11 @@ VideoReceiver::_updateTimer() ...@@ -870,9 +872,11 @@ VideoReceiver::_updateTimer()
} }
if(elapsed > (time_t)timeout && _videoSurface) { if(elapsed > (time_t)timeout && _videoSurface) {
stop(); stop();
// We want to start it back again with _updateTimer
_stop = false;
} }
} else { } else {
if(!running() && !_uri.isEmpty() && _videoSettings->streamEnabled()->rawValue().toBool()) { if(!_stop && !running() && !_uri.isEmpty() && _videoSettings->streamEnabled()->rawValue().toBool()) {
start(); start();
} }
} }
......
...@@ -114,6 +114,7 @@ private: ...@@ -114,6 +114,7 @@ private:
bool _streaming; bool _streaming;
bool _starting; bool _starting;
bool _stopping; bool _stopping;
bool _stop;
Sink* _sink; Sink* _sink;
GstElement* _tee; GstElement* _tee;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment