diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cubeb_opensl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cubeb_opensl.c b/src/cubeb_opensl.c index efac34d..ba9f208 100644 --- a/src/cubeb_opensl.c +++ b/src/cubeb_opensl.c @@ -1655,6 +1655,16 @@ opensl_stream_destroy(cubeb_stream * stm) { assert(stm->draining || stm->shutdown); + // If we're still draining at stream destroy time, pause the streams now so we + // can destroy them safely. + if (stm->draining) { + opensl_stream_stop(stm); + } + // Sleep for 10ms to give active streams time to pause so that no further + // buffer callbacks occur. Inspired by the same workaround (sleepBeforeClose) + // in liboboe. + usleep(10 * 1000); + if (stm->playerObj) { (*stm->playerObj)->Destroy(stm->playerObj); stm->playerObj = NULL; |