Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
2ae9449c
Commit
2ae9449c
authored
Oct 05, 2019
by
Leander Schulten
Browse files
AudioManager: Fix wrong indices in captureDeviceName list. Fix wrong stopping of capture devices.
parent
1303e9a3
Pipeline
#190682
passed with stage
in 5 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/audio/audiocapturemanager.cpp
View file @
2ae9449c
...
...
@@ -159,7 +159,15 @@ bool AudioCaptureManager::loadCaptureLibrary(QString name, QString filePathToCap
auto
func
=
reinterpret_cast
<
CaptureLibEntry
>
(
QLibrary
::
resolve
(
filePathToCaptureLibrary
,
"captureAudio"
));
if
(
func
)
{
// replace if name is already there
captureLibraries
.
emplace
(
name
,
func
);
auto
res
=
captureLibraries
.
emplace
(
name
,
func
);
if
(
res
.
second
)
{
auto
pos
=
std
::
distance
(
captureLibraries
.
begin
(),
res
.
first
);
captureDeviceNames
.
getVector
().
insert
(
captureDeviceNames
.
cbegin
()
+
pos
,
name
);
if
(
currentCaptureDevice
>=
pos
)
{
currentCaptureDevice
++
;
emit
currentCaptureDeviceChanged
();
}
}
}
return
func
;
}
...
...
@@ -227,6 +235,7 @@ void AudioCaptureManager::stopCapturing() {
void
AudioCaptureManager
::
stopCapturingAndWait
()
{
try
{
if
(
captureAudioThread
.
joinable
())
{
run
=
false
;
captureAudioThread
.
join
();
}
else
{
if
(
rtAudio
.
isStreamOpen
())
{
...
...
@@ -236,11 +245,11 @@ void AudioCaptureManager::stopCapturingAndWait() {
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
microseconds
(
500
));
}
}
run
=
false
;
}
}
catch
(
const
RtAudioError
&
e
)
{
ErrorNotifier
::
showError
(
"Error while stopping audio stream: "
+
QString
(
e
.
what
()));
}
run
=
false
;
emit
capturingStatusChanged
();
}
...
...
@@ -250,7 +259,7 @@ bool AudioCaptureManager::isCapturing() const {
void
AudioCaptureManager
::
updateCaptureDeviceList
()
{
QString
name
;
if
(
currentCaptureDevice
>
0
&&
currentCaptureDevice
<
captureDeviceNames
.
ssize
())
{
if
(
currentCaptureDevice
>
=
0
&&
currentCaptureDevice
<
captureDeviceNames
.
ssize
())
{
name
=
captureDeviceNames
[
currentCaptureDevice
];
}
captureDeviceNames
.
clear
();
...
...
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