Skip to content

Conversation

@miloszwielgus
Copy link
Collaborator

@miloszwielgus miloszwielgus commented Nov 4, 2025

Closes RNAA-151

⚠️ Breaking changes ⚠️

Introduced changes

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web

Copy link
Collaborator

@maciejmakowski2003 maciejmakowski2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work. thanks for spending time on fixing this one

@@ -0,0 +1,193 @@
import React, { useState, useEffect, FC, useRef } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its is not a great idea to add it to example app, we can remove it just before merge

CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = WC59N2X3FV;
DEVELOPMENT_TEAM = ARNJX758MC;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont push development team changes

}

void AudioBufferQueueSourceNode::start(double when) {
isPaused_ = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not necessary, if we add isPaused_ = false; to disable it will perfectly fix like below:

void AudioBufferQueueSourceNode::disable() {
  if (isPaused_) {
    playbackState_ = PlaybackState::UNSCHEDULED;
    startTime_ = -1.0;
    stopTime_ = -1.0;
    isPaused_ = false;

    return;
  }

  AudioScheduledSourceNode::disable();
  buffers_ = {};
}

Copy link
Collaborator Author

@miloszwielgus miloszwielgus Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I tried implementing this but it didn't fix the bug for me. If I traced it, correctly the issue stems from a race condition between the main and audio threads: when we quickly go start -> pause -> start the second start runs before the disable(), so that it still has stopTime_ = 0.0 and the node does not play. Thats why in my example adding even a 1ms delay after pause() allows disable() to run before the second start and fixes the issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, so lets add this line isPaused_ = false; to disable() as well

@miloszwielgus miloszwielgus marked this pull request as ready for review November 6, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants