Commit 56d152ff authored by Andrew Comminos's avatar Andrew Comminos Committed by Commit Bot

Avoid adding orphaned nodes to a task handler on a closed audio context.

If a BaseAudioContext is uninitialized, its render thread will no longer
clear associated orphaned render nodes (as it is stopped). Instead of
checking whether or not the context has reported itself as being closed
(which is independent of the initialization state), simply check the
initialization state itself.

R=hongchan@chromium.org

Bug: 858834
Change-Id: I5b088d17122b0c86270ff8ca75b13ab1487a2131
Reviewed-on: https://chromium-review.googlesource.com/c/1284697
Commit-Queue: Andrew Comminos <acomminos@fb.com>
Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604630}
parent d2f9d2b6
...@@ -618,11 +618,11 @@ void AudioNode::Dispose() { ...@@ -618,11 +618,11 @@ void AudioNode::Dispose() {
if (context()->HasRealtimeConstraint()) { if (context()->HasRealtimeConstraint()) {
// Add the handler to the orphan list if the context is not // Add the handler to the orphan list if the context is not
// closed. (Nothing will clean up the orphan list if the context // uninitialized (Nothing will clean up the orphan list if the context
// is closed.) These will get cleaned up in the post render task // is uninitialized.) These will get cleaned up in the post render task
// if audio thread is running or when the context is colleced (in // if audio thread is running or when the context is colleced (in
// the worst case). // the worst case).
if (context()->ContextState() != BaseAudioContext::kClosed) { if (!context()->IsContextClosed()) {
context()->GetDeferredTaskHandler().AddRenderingOrphanHandler( context()->GetDeferredTaskHandler().AddRenderingOrphanHandler(
std::move(handler_)); std::move(handler_));
} }
......
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