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
bbf9de58
Commit
bbf9de58
authored
Apr 10, 2020
by
Andrew Voznytsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pre-configured video stream start
parent
2a1f755e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
VideoManager.cc
src/VideoManager/VideoManager.cc
+20
-5
VideoManager.h
src/VideoManager/VideoManager.h
+5
-0
No files found.
src/VideoManager/VideoManager.cc
View file @
bbf9de58
...
...
@@ -124,7 +124,12 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
connect
(
_videoReceiver
[
0
],
&
VideoReceiver
::
onStartComplete
,
this
,
[
this
](
VideoReceiver
::
STATUS
status
)
{
if
(
status
==
VideoReceiver
::
STATUS_OK
)
{
_videoStarted
[
0
]
=
true
;
_videoReceiver
[
0
]
->
startDecoding
(
_videoSink
[
0
]);
if
(
_videoSink
[
0
]
!=
nullptr
)
{
// It is absolytely ok to have video receiver active (streaming) and decoding not active
// It should be handy for cases when you have many streams and want to show only some of them
// NOTE that even if decoder did not start it is still possible to record video
_videoReceiver
[
0
]
->
startDecoding
(
_videoSink
[
0
]);
}
}
else
if
(
status
==
VideoReceiver
::
STATUS_INVALID_URL
)
{
// Invalid URL - don't restart
}
else
if
(
status
==
VideoReceiver
::
STATUS_INVALID_STATE
)
{
...
...
@@ -180,7 +185,9 @@ VideoManager::setToolbox(QGCToolbox *toolbox)
connect
(
_videoReceiver
[
1
],
&
VideoReceiver
::
onStartComplete
,
this
,
[
this
](
VideoReceiver
::
STATUS
status
)
{
if
(
status
==
VideoReceiver
::
STATUS_OK
)
{
_videoStarted
[
1
]
=
true
;
_videoReceiver
[
1
]
->
startDecoding
(
_videoSink
[
1
]);
if
(
_videoSink
[
1
]
!=
nullptr
)
{
_videoReceiver
[
1
]
->
startDecoding
(
_videoSink
[
1
]);
}
}
else
if
(
status
==
VideoReceiver
::
STATUS_INVALID_URL
)
{
// Invalid URL - don't restart
}
else
if
(
status
==
VideoReceiver
::
STATUS_INVALID_STATE
)
{
...
...
@@ -573,7 +580,11 @@ VideoManager::_initVideo()
if
(
widget
!=
nullptr
&&
_videoReceiver
[
0
]
!=
nullptr
)
{
_videoSink
[
0
]
=
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
createVideoSink
(
this
,
widget
);
if
(
_videoSink
[
0
]
==
nullptr
)
{
if
(
_videoSink
[
0
]
!=
nullptr
)
{
if
(
_videoStarted
[
0
])
{
_videoReceiver
[
0
]
->
startDecoding
(
_videoSink
[
0
]);
}
}
else
{
qCDebug
(
VideoManagerLog
)
<<
"createVideoSink() failed"
;
}
}
else
{
...
...
@@ -584,7 +595,11 @@ VideoManager::_initVideo()
if
(
widget
!=
nullptr
&&
_videoReceiver
[
1
]
!=
nullptr
)
{
_videoSink
[
1
]
=
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
createVideoSink
(
this
,
widget
);
if
(
_videoSink
[
1
]
==
nullptr
)
{
if
(
_videoSink
[
1
]
!=
nullptr
)
{
if
(
_videoStarted
[
1
])
{
_videoReceiver
[
1
]
->
startDecoding
(
_videoSink
[
1
]);
}
}
else
{
qCDebug
(
VideoManagerLog
)
<<
"createVideoSink() failed"
;
}
}
else
{
...
...
@@ -741,7 +756,7 @@ VideoManager::_startReceiver(unsigned id)
if
(
id
>
1
)
{
qCDebug
(
VideoManagerLog
)
<<
"Unsupported receiver id"
<<
id
;
}
else
if
(
_videoReceiver
[
id
]
!=
nullptr
&&
_videoSink
[
id
]
!=
nullptr
)
{
}
else
if
(
_videoReceiver
[
id
]
!=
nullptr
/* && _videoSink[id] != nullptr*/
)
{
if
(
!
_videoUri
[
id
].
isEmpty
())
{
_videoReceiver
[
id
]
->
start
(
_videoUri
[
id
],
timeout
);
}
...
...
src/VideoManager/VideoManager.h
View file @
bbf9de58
...
...
@@ -158,6 +158,11 @@ protected:
VideoReceiver
*
_videoReceiver
[
2
]
=
{
nullptr
,
nullptr
};
void
*
_videoSink
[
2
]
=
{
nullptr
,
nullptr
};
QString
_videoUri
[
2
];
// FIXME: AV: _videoStarted seems to be access from 3 different threads, from time to time
// 1) Video Receiver thread
// 2) Video Manager/main app thread
// 3) Qt rendering thread (during video sink creation process which should happen in this thread)
// It works for now but...
bool
_videoStarted
[
2
]
=
{
false
,
false
};
QAtomicInteger
<
bool
>
_streaming
=
false
;
QAtomicInteger
<
bool
>
_decoding
=
false
;
...
...
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