aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-02-25 02:03:43 -0800
committerChris Robinson <[email protected]>2019-02-25 02:03:43 -0800
commit8a34bd59b009c2deee120aa2685965f7bed7fab8 (patch)
treeeaa2f585a6492870bf28c0843618fcefb45e3517 /examples
parent81aa5af3b97e453b8793e9b02cb48a81f69a83ff (diff)
Unlock the audio decoder mutex before disabling events in alffplay
The callback may be waiting on the mutex, but disabling the callback needs any current invocation to finish first.
Diffstat (limited to 'examples')
-rw-r--r--examples/alffplay.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/alffplay.cpp b/examples/alffplay.cpp
index c51c5119..31099c75 100644
--- a/examples/alffplay.cpp
+++ b/examples/alffplay.cpp
@@ -748,7 +748,7 @@ void AL_APIENTRY AudioState::EventCallback(ALenum eventType, ALuint object, ALui
int AudioState::handler()
{
- std::unique_lock<std::mutex> lock(mSrcMutex);
+ std::unique_lock<std::mutex> srclock(mSrcMutex);
milliseconds sleep_time = AudioBufferTime / 3;
ALenum fmt;
@@ -1074,7 +1074,7 @@ int AudioState::handler()
mMovie.mPlaying.load(std::memory_order_relaxed))
startPlayback();
- mSrcCond.wait_for(lock, sleep_time);
+ mSrcCond.wait_for(srclock, sleep_time);
}
alSourceRewind(mSource);
@@ -1082,6 +1082,7 @@ int AudioState::handler()
finish:
av_freep(&samples);
+ srclock.unlock();
#ifdef AL_SOFT_events
if(alEventControlSOFT)