Commit dfffd3bc authored by Gus Grubba's avatar Gus Grubba

Define how long to wait for RTSP frame before deciding the link is gone.

parent 081d2ee9
......@@ -69,5 +69,14 @@
"min": 100,
"units": "MB",
"defaultValue": 2048
},
{
"name": "RtspTimeout",
"shortDescription": "RTSP Video Timeout",
"longDescription": "How long to wait before assuming RTSP link is gone.",
"type": "uint32",
"min": 1,
"units": "s",
"defaultValue": 2
}
]
......@@ -27,6 +27,7 @@ const char* VideoSettings::videoGridLinesName = "VideoGridLines";
const char* VideoSettings::showRecControlName = "ShowRecControl";
const char* VideoSettings::recordingFormatName = "RecordingFormat";
const char* VideoSettings::maxVideoSizeName = "MaxVideoSize";
const char* VideoSettings::rtspTimeoutName = "RtspTimeout";
const char* VideoSettings::videoSourceNoVideo = "No Video Available";
const char* VideoSettings::videoDisabled = "Video Stream Disabled";
......@@ -43,6 +44,7 @@ VideoSettings::VideoSettings(QObject* parent)
, _showRecControlFact(NULL)
, _recordingFormatFact(NULL)
, _maxVideoSizeFact(NULL)
, _rtspTimeoutFact(NULL)
{
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<VideoSettings>("QGroundControl.SettingsManager", 1, 0, "VideoSettings", "Reference only");
......@@ -153,3 +155,12 @@ Fact* VideoSettings::maxVideoSize(void)
return _maxVideoSizeFact;
}
Fact* VideoSettings::rtspTimeout(void)
{
if (!_rtspTimeoutFact) {
_rtspTimeoutFact = _createSettingsFact(rtspTimeoutName);
}
return _rtspTimeoutFact;
}
......@@ -27,6 +27,7 @@ public:
Q_PROPERTY(Fact* showRecControl READ showRecControl CONSTANT)
Q_PROPERTY(Fact* recordingFormat READ recordingFormat CONSTANT)
Q_PROPERTY(Fact* maxVideoSize READ maxVideoSize CONSTANT)
Q_PROPERTY(Fact* rtspTimeout READ rtspTimeout CONSTANT)
Fact* videoSource (void);
Fact* udpPort (void);
......@@ -36,6 +37,7 @@ public:
Fact* showRecControl (void);
Fact* recordingFormat (void);
Fact* maxVideoSize (void);
Fact* rtspTimeout (void);
static const char* videoSettingsGroupName;
......@@ -47,6 +49,7 @@ public:
static const char* showRecControlName;
static const char* recordingFormatName;
static const char* maxVideoSizeName;
static const char* rtspTimeoutName;
static const char* videoSourceNoVideo;
static const char* videoDisabled;
......@@ -62,6 +65,7 @@ private:
SettingsFact* _showRecControlFact;
SettingsFact* _recordingFormatFact;
SettingsFact* _maxVideoSizeFact;
SettingsFact* _rtspTimeoutFact;
};
#endif
......@@ -768,12 +768,13 @@ VideoReceiver::_updateTimer()
}
}
if(_videoRunning) {
uint32_t timeout = qgcApp()->toolbox()->settingsManager()->videoSettings()->rtspTimeout()->rawValue().toUInt();
time_t elapsed = 0;
time_t lastFrame = _videoSurface->lastFrame();
if(lastFrame != 0) {
elapsed = time(0) - _videoSurface->lastFrame();
}
if(elapsed > 2 && _videoSurface) {
if(elapsed > timeout && _videoSurface) {
stop();
}
} else {
......
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