Skip to content
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

Invalidate timing info buffers when destorying AAudio stream. #784

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

jhlin
Copy link
Contributor

@jhlin jhlin commented Apr 29, 2024

aaudio_stream_get_position() returns incorrect result because aaudio_stream_init() recycled destroyed stream where the timing_info buffers contain stale data.

@jhlin
Copy link
Contributor Author

jhlin commented Apr 29, 2024

This is to fix Fenix bug 1872354

Copy link
Collaborator

@kinetiknz kinetiknz left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! One comment, but overall this looks good to me.

@@ -1014,6 +1014,8 @@ aaudio_stream_destroy_locked(cubeb_stream * stm, lock_guard<mutex> & lock)
stm->state == stream_state::ERROR ||
stm->state == stream_state::SHUTDOWN);

stm->timing_info.invalidate();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think invalidate should happen after after ostream and istream are stopped, otherwise there's the potential for an audio callback to call compute_and_report_latency_metrics between invalidate and the rest of the stream destruction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I've amended the commit and moved invalidate() to after streams stopped. Thanks for the review.

aaudio_stream_get_position() returns incorrect result because
aaudio_stream_init() recycled destroyed stream where the
timing_info buffers contain stale data.
Copy link
Collaborator

@kinetiknz kinetiknz left a comment

Choose a reason for hiding this comment

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

Thanks!

@kinetiknz kinetiknz merged commit 19fcbef into mozilla:master Apr 29, 2024
11 checks passed
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.

2 participants