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

Do not access AudioWorklet::IsReady() from the audio thread

AudioWorklet::IsReady() checks the state of the worklet object and
must be accessed from the main thread.

OfflineAudioDestinationHandler::DoOfflineRendering() violates the rule
and this CL fixes GetRenderingThread() method to check the assigned
worklet thread instead.

Bug: 804908
Change-Id: I1ff1f779a3bb75d1715f521a2656a7c6c8c51a9f
Reviewed-on: https://chromium-review.googlesource.com/882121Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532571}
parent de25cb02
......@@ -360,18 +360,17 @@ bool OfflineAudioDestinationHandler::RenderIfNotSuspended(
WebThread* OfflineAudioDestinationHandler::GetRenderingThread() {
DCHECK(IsInitialized());
// Use Experimental AudioWorkletThread only when AudioWorklet is enabled, and
// the worklet thread and the global scope are ready.
if (Context()->audioWorklet() && Context()->audioWorklet()->IsReady()) {
DCHECK(!render_thread_ && worklet_backing_thread_);
if (worklet_backing_thread_) {
return worklet_backing_thread_;
}
DCHECK(render_thread_ && !worklet_backing_thread_);
DCHECK(render_thread_);
return render_thread_.get();
}
void OfflineAudioDestinationHandler::RestartRendering() {
DCHECK(IsMainThread());
// If the worklet thread is not assigned yet, that means the context has
// started without a valid WorkletGlobalScope. Assign the worklet thread,
// and it will be picked up when the GetRenderingThread() is called next.
......
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