fix(audio-openal): restore briefing video audio#100
Merged
Conversation
Briefing audio played during gameplay instead of loading screen on Linux/macOS (OpenAL builds). The FFmpegVideoStream destructor freed FFmpeg resources but left the OpenAL source (m_binkAudio) with queued audio buffers still active, which drained into early mission frames. Fix: call audioStream->reset() in ~FFmpegVideoStream under SAGE_USE_OPENAL with null-guards. Applied to both Core and GeneralsMD. Confirmed on Generals base and Zero Hour. Fixes: #38
Two bugs caused campaign briefing videos to play without audio on Linux/macOS (OpenAL builds): 1. OpenALAudioStream::update() only restarted playback on AL_STOPPED. After reset() on a freshly created stream, alSourceStop() is a no-op on AL_INITIAL, so the source stays AL_INITIAL. Audio frames arriving via onFrame() called update(), but AL_INITIAL != AL_STOPPED skipped play() entirely. Fix: also restart on AL_INITIAL state. 2. LoadScreen::init() runs a blocking video loop that never reaches the main game loop, so TheVideoPlayer->update() (which calls FFmpegVideoStream::update() -> play() if not already playing) was never invoked. Audio source underruns had no recovery path. Fix: call TheVideoPlayer->update() after each frameNext(). Related: #38
… loop Same blocking loop issue as SinglePlayerLoadScreen: the ChallengeLoadScreen video loop never returns to the main game loop, so TheVideoPlayer->update() was never called. Without it the OpenAL source could stay AL_INITIAL or underrun with no recovery. Related: #38
OpenAL-Soft on macOS auto-pauses all sources via Core Audio session suspension when the application loses window focus. A momentary focus loss during the shell-map to loading-screen transition caused the video audio source to enter AL_PAUSED and never recover, resulting in silent video playback for the rest of the session. update() in OpenALAudioStream now handles AL_PAUSED alongside AL_STOPPED and AL_INITIAL: whenever the source is not playing and buffers are queued, alSourcePlay() is called to resume. Also removes temporary diagnostic fprintfs that were used to trace the root cause via logs/issue_38.log. Issue: #38
Keep the shared OpenAL stream from unqueueing processed buffers before restart, which could drop freshly queued briefing audio during video transitions. Backport the stable FFmpeg-side fixes into the shared Generals path by forcing stream gain to 1.0f, rejecting invalid decoded frame sizes, and converting float FFmpeg audio to PCM16 before queueing into OpenAL. Also remove the temporary audit instrumentation used to isolate the issue and update the April dev diary. Fixes #38
Register references/fbraz3-dxvk as a proper git submodule entry (gitlink mode 160000) using the existing .gitmodules configuration pointing to fbraz3/dxvk on branch generalsx-macos-v2.6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the briefing and video-audio regression from issue #38 by stabilizing the shared OpenAL streaming path and backporting the FFmpeg-side hardening needed by the base Generals path.
What changed
1.0fbefore playback startValidation
GX-AUDIT,Temporary audit, orRuntime auditmarkers remain in the touched filesFixes #38