Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
58b8db24
Commit
58b8db24
authored
Apr 13, 2020
by
Andrew Voznytsa
Browse files
More consistent video receiver state handling
parent
ff1eb2d3
Changes
3
Show whitespace changes
Inline
Side-by-side
VideoReceiverApp/main.cpp
View file @
58b8db24
...
...
@@ -302,25 +302,8 @@ VideoReceiverApp::exec()
startStreaming
();
QObject
::
connect
(
_receiver
,
&
VideoReceiver
::
timeout
,
[
this
](){
QObject
::
connect
(
_receiver
,
&
VideoReceiver
::
timeout
,
[](){
qCDebug
(
AppLog
)
<<
"Streaming timeout"
;
_dispatch
([
this
](){
if
(
_streaming
)
{
_receiver
->
stop
();
}
else
{
if
(
--
_connect
>
0
)
{
qCDebug
(
AppLog
)
<<
"Restarting streaming"
;
_dispatch
([
this
](){
startStreaming
();
});
}
else
{
qCDebug
(
AppLog
)
<<
"Closing..."
;
delete
_receiver
;
_app
.
exit
();
}
}
});
});
QObject
::
connect
(
_receiver
,
&
VideoReceiver
::
streamingChanged
,
[
this
](
bool
active
){
...
...
@@ -329,16 +312,6 @@ VideoReceiverApp::exec()
qCDebug
(
AppLog
)
<<
"Streaming started"
;
}
else
{
qCDebug
(
AppLog
)
<<
"Streaming stopped"
;
_dispatch
([
this
](){
if
(
--
_connect
>
0
)
{
qCDebug
(
AppLog
)
<<
"Restarting streaming"
;
startStreaming
();
}
else
{
qCDebug
(
AppLog
)
<<
"Closing..."
;
delete
_receiver
;
_app
.
exit
();
}
});
}
});
...
...
@@ -374,6 +347,44 @@ VideoReceiverApp::exec()
}
});
QObject
::
connect
(
_receiver
,
&
VideoReceiver
::
onStartComplete
,
[
this
](
VideoReceiver
::
STATUS
status
){
if
(
status
!=
VideoReceiver
::
STATUS_OK
)
{
qCDebug
(
AppLog
)
<<
"Video receiver start failed"
;
_dispatch
([
this
](){
if
(
--
_connect
>
0
)
{
qCDebug
(
AppLog
)
<<
"Restarting ..."
;
_dispatch
([
this
](){
startStreaming
();
});
}
else
{
qCDebug
(
AppLog
)
<<
"Closing..."
;
delete
_receiver
;
_app
.
exit
();
}
});
}
else
{
qCDebug
(
AppLog
)
<<
"Video receiver started"
;
}
});
QObject
::
connect
(
_receiver
,
&
VideoReceiver
::
onStopComplete
,
[
this
](
VideoReceiver
::
STATUS
){
qCDebug
(
AppLog
)
<<
"Video receiver stopped"
;
_dispatch
([
this
](){
if
(
--
_connect
>
0
)
{
qCDebug
(
AppLog
)
<<
"Restarting ..."
;
_dispatch
([
this
](){
startStreaming
();
});
}
else
{
qCDebug
(
AppLog
)
<<
"Closing..."
;
delete
_receiver
;
_app
.
exit
();
}
});
});
return
_app
.
exec
();
}
...
...
src/VideoManager/VideoManager.cc
View file @
58b8db24
...
...
@@ -115,14 +115,9 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
_videoReceiver
[
0
]
=
toolbox
->
corePlugin
()
->
createVideoReceiver
(
this
);
_videoReceiver
[
1
]
=
toolbox
->
corePlugin
()
->
createVideoReceiver
(
this
);
connect
(
_videoReceiver
[
0
],
&
VideoReceiver
::
timeout
,
this
,
[
this
](){
_stopReceiver
(
0
);
});
connect
(
_videoReceiver
[
0
],
&
VideoReceiver
::
streamingChanged
,
this
,
[
this
](
bool
active
){
_streaming
=
active
;
emit
streamingChanged
();
_restartVideo
(
0
);
});
connect
(
_videoReceiver
[
0
],
&
VideoReceiver
::
onStartComplete
,
this
,
[
this
](
VideoReceiver
::
STATUS
status
)
{
...
...
@@ -178,14 +173,6 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
// FIXME: AV: I believe _thermalVideoReceiver should be handled just like _videoReceiver in terms of event
// and I expect that it will be changed during multiple video stream activity
if
(
_videoReceiver
[
1
]
!=
nullptr
)
{
connect
(
_videoReceiver
[
1
],
&
VideoReceiver
::
timeout
,
this
,
[
this
](){
_stopReceiver
(
1
);
});
connect
(
_videoReceiver
[
1
],
&
VideoReceiver
::
streamingChanged
,
this
,
[
this
](
bool
active
){
_restartVideo
(
1
);
});
connect
(
_videoReceiver
[
1
],
&
VideoReceiver
::
onStartComplete
,
this
,
[
this
](
VideoReceiver
::
STATUS
status
)
{
if
(
status
==
VideoReceiver
::
STATUS_OK
)
{
_videoStarted
[
1
]
=
true
;
...
...
src/VideoReceiver/GstVideoReceiver.cc
View file @
58b8db24
...
...
@@ -644,6 +644,7 @@ GstVideoReceiver::_watchdog(void)
_dispatchSignal
([
this
](){
emit
timeout
();
});
stop
();
}
if
(
_decoding
&&
!
_removingDecoder
)
{
...
...
@@ -656,6 +657,7 @@ GstVideoReceiver::_watchdog(void)
_dispatchSignal
([
this
](){
emit
timeout
();
});
stop
();
}
}
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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