Skip to content
Snippets Groups Projects
Commit e23414c5 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

opensl: lock mutex in AudioPlayer::stop

Change-Id: I618ae6f9ae849832e7704150b72f3c9ff3ba2cf4
parent 62e29720
No related branches found
No related tags found
No related merge requests found
...@@ -170,6 +170,7 @@ AudioPlayer::AudioPlayer(jami::AudioFormat sampleFormat, ...@@ -170,6 +170,7 @@ AudioPlayer::AudioPlayer(jami::AudioFormat sampleFormat,
AudioPlayer::~AudioPlayer() AudioPlayer::~AudioPlayer()
{ {
JAMI_DBG("Destroying OpenSL playback stream"); JAMI_DBG("Destroying OpenSL playback stream");
std::lock_guard<std::mutex> lk(m_);
// destroy buffer queue audio player object, and invalidate all associated interfaces // destroy buffer queue audio player object, and invalidate all associated interfaces
if (playerObjectItf_) { if (playerObjectItf_) {
...@@ -192,6 +193,7 @@ AudioPlayer::setBufQueue(AudioQueue* playQ, AudioQueue* freeQ) ...@@ -192,6 +193,7 @@ AudioPlayer::setBufQueue(AudioQueue* playQ, AudioQueue* freeQ)
bool bool
AudioPlayer::start() AudioPlayer::start()
{ {
std::lock_guard<std::mutex> lk(m_);
JAMI_DBG("OpenSL playback start"); JAMI_DBG("OpenSL playback start");
SLuint32 state; SLuint32 state;
SLresult result = (*playItf_)->GetPlayState(playItf_, &state); SLresult result = (*playItf_)->GetPlayState(playItf_, &state);
...@@ -227,6 +229,7 @@ void ...@@ -227,6 +229,7 @@ void
AudioPlayer::stop() AudioPlayer::stop()
{ {
JAMI_DBG("OpenSL playback stop"); JAMI_DBG("OpenSL playback stop");
std::lock_guard<std::mutex> lk(m_);
SLuint32 state; SLuint32 state;
SLresult result = (*playItf_)->GetPlayState(playItf_, &state); SLresult result = (*playItf_)->GetPlayState(playItf_, &state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment