-
-
Notifications
You must be signed in to change notification settings - Fork 32
Fix/pause on audio buffer queue source node #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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'; | |||
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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_ = {};
}
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Closes RNAA-151
Introduced changes
Checklist