Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
7e2c88bd
Commit
7e2c88bd
authored
May 12, 2019
by
Matej Frančeškin
Committed by
Matej Frančeškin
May 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure Video Stream: Allow video stream restart and reconnect after changing video encoding.
parent
b41a6b9a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
120 deletions
+75
-120
VideoManager.cc
src/FlightDisplay/VideoManager.cc
+17
-10
VideoManager.h
src/FlightDisplay/VideoManager.h
+2
-2
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+40
-95
VideoReceiver.h
src/VideoStreaming/VideoReceiver.h
+16
-13
No files found.
src/FlightDisplay/VideoManager.cc
View file @
7e2c88bd
/****************************************************************************
*
* (c) 2009-201
6
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* (c) 2009-201
9
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
...
...
@@ -206,28 +206,28 @@ VideoManager::_videoSourceChanged()
emit
hasVideoChanged
();
emit
isGStreamerChanged
();
emit
isAutoStreamChanged
();
_
restartVideo
();
restartVideo
();
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_udpPortChanged
()
{
_
restartVideo
();
restartVideo
();
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_rtspUrlChanged
()
{
_
restartVideo
();
restartVideo
();
}
//-----------------------------------------------------------------------------
void
VideoManager
::
_tcpUrlChanged
()
{
_
restartVideo
();
restartVideo
();
}
//-----------------------------------------------------------------------------
...
...
@@ -275,7 +275,14 @@ VideoManager::_updateSettings()
return
;
//-- Auto discovery
if
(
_activeVehicle
&&
_activeVehicle
->
dynamicCameras
())
{
QGCVideoStreamInfo
*
pInfo
=
_activeVehicle
->
dynamicCameras
()
->
currentStreamInstance
();
QGCCameraControl
*
pCamera
=
_activeVehicle
->
dynamicCameras
()
->
currentCameraInstance
();
if
(
pCamera
)
{
Fact
*
fact
=
pCamera
->
videoEncoding
();
if
(
fact
)
{
_videoReceiver
->
setVideoDecoder
(
static_cast
<
VideoReceiver
::
VideoEncoding
>
(
fact
->
rawValue
().
toInt
()));
}
}
QGCVideoStreamInfo
*
pInfo
=
_activeVehicle
->
dynamicCameras
()
->
currentStreamInstance
();
if
(
pInfo
)
{
qCDebug
(
VideoManagerLog
)
<<
"Configure primary stream: "
<<
pInfo
->
uri
();
switch
(
pInfo
->
type
())
{
...
...
@@ -329,7 +336,7 @@ VideoManager::_updateSettings()
//-----------------------------------------------------------------------------
void
VideoManager
::
_
restartVideo
()
VideoManager
::
restartVideo
()
{
#if defined(QGC_GST_STREAMING)
qCDebug
(
VideoManagerLog
)
<<
"Restart video streaming"
;
...
...
@@ -350,13 +357,13 @@ VideoManager::_setActiveVehicle(Vehicle* vehicle)
if
(
pCamera
)
{
pCamera
->
stopStream
();
}
disconnect
(
_activeVehicle
->
dynamicCameras
(),
&
QGCCameraManager
::
streamChanged
,
this
,
&
VideoManager
::
_
restartVideo
);
disconnect
(
_activeVehicle
->
dynamicCameras
(),
&
QGCCameraManager
::
streamChanged
,
this
,
&
VideoManager
::
restartVideo
);
}
}
_activeVehicle
=
vehicle
;
if
(
_activeVehicle
)
{
if
(
_activeVehicle
->
dynamicCameras
())
{
connect
(
_activeVehicle
->
dynamicCameras
(),
&
QGCCameraManager
::
streamChanged
,
this
,
&
VideoManager
::
_
restartVideo
);
connect
(
_activeVehicle
->
dynamicCameras
(),
&
QGCCameraManager
::
streamChanged
,
this
,
&
VideoManager
::
restartVideo
);
QGCCameraControl
*
pCamera
=
_activeVehicle
->
dynamicCameras
()
->
currentCameraInstance
();
if
(
pCamera
)
{
pCamera
->
resumeStream
();
...
...
@@ -364,7 +371,7 @@ VideoManager::_setActiveVehicle(Vehicle* vehicle)
}
}
emit
autoStreamConfiguredChanged
();
_
restartVideo
();
restartVideo
();
}
//----------------------------------------------------------------------------------------
...
...
src/FlightDisplay/VideoManager.h
View file @
7e2c88bd
/****************************************************************************
*
* (c) 2009-201
6
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* (c) 2009-201
9
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
...
...
@@ -62,6 +62,7 @@ public:
double
thermalHfov
();
bool
autoStreamConfigured
();
bool
hasThermal
();
void
restartVideo
();
VideoReceiver
*
videoReceiver
()
{
return
_videoReceiver
;
}
VideoReceiver
*
thermalVideoReceiver
()
{
return
_thermalVideoReceiver
;
}
...
...
@@ -99,7 +100,6 @@ private slots:
void
_updateUVC
();
void
_setActiveVehicle
(
Vehicle
*
vehicle
);
void
_aspectRatioChanged
();
void
_restartVideo
();
private:
void
_updateSettings
();
...
...
src/VideoStreaming/VideoReceiver.cc
View file @
7e2c88bd
This diff is collapsed.
Click to expand it.
src/VideoStreaming/VideoReceiver.h
View file @
7e2c88bd
/****************************************************************************
*
* (c) 2009-201
8
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
* (c) 2009-201
9
QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
...
...
@@ -34,6 +34,13 @@ class VideoReceiver : public QObject
{
Q_OBJECT
public:
enum
VideoEncoding
{
H264_SW
=
1
,
H264_HW
=
2
,
H265_SW
=
3
,
H265_HW
=
4
};
#if defined(QGC_GST_STREAMING)
Q_PROPERTY
(
bool
recording
READ
recording
NOTIFY
recordingChanged
)
#endif
...
...
@@ -47,11 +54,7 @@ public:
~
VideoReceiver
();
#if defined(QGC_GST_STREAMING)
virtual
bool
running
()
{
return
_running
;
}
virtual
bool
recording
()
{
return
_recording
;
}
virtual
bool
streaming
()
{
return
_streaming
;
}
virtual
bool
starting
()
{
return
_starting
;
}
virtual
bool
stopping
()
{
return
_stopping
;
}
#endif
virtual
VideoSurface
*
videoSurface
()
{
return
_videoSurface
;
}
...
...
@@ -64,6 +67,8 @@ public:
virtual
void
setShowFullScreen
(
bool
show
)
{
_showFullScreen
=
show
;
emit
showFullScreenChanged
();
}
void
setVideoDecoder
(
VideoEncoding
encoding
);
signals:
void
videoRunningChanged
();
void
imageFileChanged
();
...
...
@@ -86,9 +91,7 @@ public slots:
protected
slots
:
virtual
void
_updateTimer
();
#if defined(QGC_GST_STREAMING)
virtual
void
_timeout
();
virtual
void
_connected
();
virtual
void
_socketError
(
QAbstractSocket
::
SocketError
socketError
);
virtual
void
_restart_timeout
();
virtual
void
_handleError
();
virtual
void
_handleEOS
();
virtual
void
_handleStateChanged
();
...
...
@@ -132,14 +135,11 @@ protected:
//-- Wait for Video Server to show up before starting
QTimer
_frameTimer
;
QTimer
_timer
;
QTcpSocket
*
_socket
;
bool
_serverPresent
;
int
_rtspTestInterval_ms
;
QTimer
_restart_timer
;
int
_restart_time_ms
;
//-- RTSP UDP reconnect timeout
uint64_t
_udpReconnect_us
;
#endif
QString
_uri
;
...
...
@@ -149,5 +149,8 @@ protected:
bool
_videoRunning
;
bool
_showFullScreen
;
VideoSettings
*
_videoSettings
;
const
char
*
_depayName
;
const
char
*
_parserName
;
const
char
*
_decoderName
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment