Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
d97121c4
Commit
d97121c4
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
opensl: init audio engine on first use
Change-Id: Idc8e5bd4614212ecba3b8a075aaf91811ec97af1
parent
790418d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/media/audio/opensl/opensllayer.cpp
+11
-7
11 additions, 7 deletions
src/media/audio/opensl/opensllayer.cpp
with
11 additions
and
7 deletions
src/media/audio/opensl/opensllayer.cpp
+
11
−
7
View file @
d97121c4
...
@@ -44,7 +44,6 @@ namespace jami {
...
@@ -44,7 +44,6 @@ namespace jami {
OpenSLLayer
::
OpenSLLayer
(
const
AudioPreference
&
pref
)
OpenSLLayer
::
OpenSLLayer
(
const
AudioPreference
&
pref
)
:
AudioLayer
(
pref
)
:
AudioLayer
(
pref
)
{
{
initAudioEngine
();
}
}
// Destructor
// Destructor
...
@@ -57,8 +56,12 @@ void
...
@@ -57,8 +56,12 @@ void
OpenSLLayer
::
startStream
(
AudioDeviceType
stream
)
OpenSLLayer
::
startStream
(
AudioDeviceType
stream
)
{
{
using
namespace
std
::
placeholders
;
using
namespace
std
::
placeholders
;
if
(
engineObject_
)
initAudioEngine
();
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
JAMI_WARN
(
"Start OpenSL audio layer"
);
JAMI_WARN
(
"Start OpenSL audio layer"
);
if
(
stream
==
AudioDeviceType
::
PLAYBACK
)
{
if
(
stream
==
AudioDeviceType
::
PLAYBACK
)
{
if
(
not
player_
)
{
if
(
not
player_
)
{
try
{
try
{
...
@@ -181,8 +184,6 @@ OpenSLLayer::shutdownAudioEngine()
...
@@ -181,8 +184,6 @@ OpenSLLayer::shutdownAudioEngine()
{
{
JAMI_DBG
(
"Stopping OpenSL"
);
JAMI_DBG
(
"Stopping OpenSL"
);
stopAudioCapture
();
stopAudioCapture
();
freeRecBufQueue_
.
clear
();
recBufQueue_
.
clear
();
if
(
player_
)
{
if
(
player_
)
{
player_
->
stop
();
player_
->
stop
();
...
@@ -192,10 +193,6 @@ OpenSLLayer::shutdownAudioEngine()
...
@@ -192,10 +193,6 @@ OpenSLLayer::shutdownAudioEngine()
ringtone_
->
stop
();
ringtone_
->
stop
();
ringtone_
.
reset
();
ringtone_
.
reset
();
}
}
freePlayBufQueue_
.
clear
();
playBufQueue_
.
clear
();
freeRingBufQueue_
.
clear
();
ringBufQueue_
.
clear
();
// destroy engine object, and invalidate all associated interfaces
// destroy engine object, and invalidate all associated interfaces
JAMI_DBG
(
"Shutdown audio engine"
);
JAMI_DBG
(
"Shutdown audio engine"
);
...
@@ -205,6 +202,13 @@ OpenSLLayer::shutdownAudioEngine()
...
@@ -205,6 +202,13 @@ OpenSLLayer::shutdownAudioEngine()
engineInterface_
=
nullptr
;
engineInterface_
=
nullptr
;
}
}
freeRecBufQueue_
.
clear
();
recBufQueue_
.
clear
();
freePlayBufQueue_
.
clear
();
playBufQueue_
.
clear
();
freeRingBufQueue_
.
clear
();
ringBufQueue_
.
clear
();
startedCv_
.
notify_all
();
startedCv_
.
notify_all
();
bufs_
.
clear
();
bufs_
.
clear
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment