Commit 6a2e670a authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Obtain graph/process lock when nullifying the buffer in Reverb

When the buffer is set to `null` while there is an active buffer
within a reverb object, SetBuffer() function can prematurely
nullify the `reverb_` and `shared_buffer_` while it is still
being accessed by the rendering thread.

This CL adds two locks (graph lock and process lock) when the
buffer gets nullified to ensure the synchronization between
two threads.

Change-Id: I8f501b6a16b3c7e16db767e0b279a1a53d6eb290
Bug: 1019226
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888103
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710627}
parent ed6d1f0b
...@@ -103,6 +103,8 @@ void ConvolverHandler::SetBuffer(AudioBuffer* buffer, ...@@ -103,6 +103,8 @@ void ConvolverHandler::SetBuffer(AudioBuffer* buffer,
DCHECK(IsMainThread()); DCHECK(IsMainThread());
if (!buffer) { if (!buffer) {
BaseAudioContext::GraphAutoLocker context_locker(Context());
MutexLocker locker(process_lock_);
reverb_.reset(); reverb_.reset();
shared_buffer_ = nullptr; shared_buffer_ = nullptr;
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment