Skip to content

Conversation

@cedrik-fuoco-adsk
Copy link
Contributor

SG-40625 - Play Forward/Pause button stops responding when playing media files (Linux)

Linked issues

n/a

Summarize your change.

Describe the reason for the change.

There was a stability problem where calling stop() or reset() on the QAudioOutput object would cause audio playback to break after multiple play/stop cycles. To work around this, suspend() was used instead, which solved the instability. However, this introduced a second problem: suspend() does not clear the audio device's internal buffer. This resulted in an audio bleed issue, where sound from the previously played media could be heard for a fraction of a second when starting a new one.

Describe what you have tested and on which operating system.

This change introduces a new flushing mechanism that resolves the audio bleed on Linux while avoiding the unstable stop() and reset() calls.

When playback is stopped, instead of immediately suspending the audio device, a new flushing process is initiated. The audio device is kept active momentarily while it is fed with silent audio data, completely overwriting the contents of its internal buffer. Once the buffer is flushed, the device is safely suspended.

This ensures that the audio buffer is clear before the next playback begins, eliminating audio bleed. Because this approach continues to use suspend() to halt the device, it maintains the stability of the audio system.

This logic is confined to the Linux platform and does not affect the behavior on MacOS or Windows.

Add a list of changes, and note any that might need special attention during the review.

If possible, provide screenshots.

Copy link
Contributor

@bernie-laberge bernie-laberge left a comment

Choose a reason for hiding this comment

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

LGTM
Please make sure to ask QA to do lots of audio testing on Linux (since it is the only affected platform in this commit)

@pbergeron-adsk pbergeron-adsk self-requested a review November 25, 2025 15:43
Copy link
Contributor

@pbergeron-adsk pbergeron-adsk left a comment

Choose a reason for hiding this comment

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

LGTM, and whoa nice find.

Signed-off-by: Cédrik Fuoco <[email protected]>
@cedrik-fuoco-adsk cedrik-fuoco-adsk merged commit 65c6472 into AcademySoftwareFoundation:main Nov 25, 2025
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants