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

AAudio: offset position after reinitialization #792

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

jhlin
Copy link
Contributor

@jhlin jhlin commented Jul 9, 2024

When reinitializating (due to output device change), cubeb_stream::previous_clock isn't reset properly but stream gets reset and restarts AAudioTimingInfo::output_frame_index from zero. Therefore, aaudio_stream_get_position() always reports previous clock rather than actual position until it is surpassed later. (See Gecko bug.)

This patch:

  • renames position_interpolator to position_estimate for the additional responsibility.
  • gets the number of frames sent to stream before it's destroyed and saves the value to position_estimate as the basis for future position estimation.

When reinitializating, `cubeb_stream::previous_clock` isn't reset
properly but stream gets reset and restarts `AAudioTimingInfo::output_frame_index`
from zero. Therefore, `aaudio_stream_get_position()` always reports
previous clock rather than actual position until it is surpassed later.

To estimate the position correctly, Save the number of frames sent
to stream before it's reset, and use the value as the basis for
future position estimation.
@padenot padenot merged commit bbbe5bb into mozilla:master Jul 10, 2024
15 checks passed
@jhlin jhlin deleted the aaudio-reinit-position branch July 12, 2024 01:45
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