fix: AudioContext::resume reanimates the failed Oboe stream due to the change in AudioPlayer::resume - #1252
fix: AudioContext::resume reanimates the failed Oboe stream due to the change in AudioPlayer::resume #1252basiav wants to merge 8 commits into
Conversation
WPT non-regression comparisonPASS — no regressions · 5 improved section(s) · overall 2632 → 2717 (+85)
Per-file data unavailable in one of the reports — category-level comparison only. Unchanged sections (23)
Baseline: Workflow run · this comment is updated on every push. |
| const bool wasRunning = isRunning_.load(std::memory_order_acquire); | ||
|
|
||
| if (!rebuildStream()) { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
If rebuildStream fails, isRunning flag may stay true.
| if (error != oboe::Result::ErrorDisconnected || driverMutex_ == nullptr) { | ||
| // error != oboe::Result::ErrorDisconnected condition is deleted to handle more cases of errors | ||
| if (driverMutex_ == nullptr) { |
There was a problem hiding this comment.
Removing this guard seems really dangerous to me. Consider this: should all types of errors result in stream rebuild retry? What about some non-recoverable errors, won't that create an infinite loop? Maybe it is better to choose action in response to specific errors - oboe::Result is not that big of an enum.
| if (mStream_ != nullptr) { | ||
| auto result = mStream_->requestStart() == oboe::Result::OK; | ||
| isRunning_.store(result, std::memory_order_release); | ||
| return result; | ||
| if (mStream_->requestStart() == oboe::Result::OK) { | ||
| isRunning_.store(true, std::memory_order_release); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| if (rebuildStream()) { | ||
| if (mStream_ != nullptr && mStream_->requestStart() == oboe::Result::OK) { | ||
| isRunning_.store(true, std::memory_order_release); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| isRunning_.store(false, std::memory_order_release); | ||
| return false; |
There was a problem hiding this comment.
I'm not a fan of resume being responsible for rebuilding the stream. Seems like it tries to act both as resume and start.
…logic from resume
Closes #1230
Introduced changes
AudioPlayer::onErrorAfterCloseAudioPlayer::onErrorAfterClose:ErrorDisconnected,ErrorTimeout,ErrorNoService,ErrorInternal.AudioContext::onStreamFailis called.AudioContext::onStreamFailAudioPlayer::cleanupprocedure, setsisInitialized_to false, invokesonerrordefined in JS.Checklist