Repository navigation
Fix --audio-wait-open with silent lead-in on open - #18890
Open
ThatDevopsGuy wants to merge 1 commit into
Open
ThatDevopsGuy wants to merge 1 commit into
ThatDevopsGuy wants to merge 1 commit into
Conversation
Since b74c09e refactored AO data passing into async queues, ao_c->ao_resume_time was set from --audio-wait-open on AO init but never checked before transitioning STATUS_SYNCING to STATUS_READY, leaving the option non-functional. Add AO_INIT_WAIT_OPEN so timed pull and push AOs stream silence immediately on open until ao_start() is called, and hold STATUS_SYNCING in fill_audio_out_buffers() via mp_set_timeout() until ao_resume_time elapses. Clear ao_resume_time on audio state resets and update the --audio-wait-open documentation accordingly.
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.
This PR, specifically:
--audio-wait-open=<secs>to let an HDMI/eARC receiver lock onto a new stream causes the option to be completely ignored (cutting off the first ~0.4–1.5 s of audio), by streaming silence as soon as the audio device opens and holding playback start until the wait period elapses.Files changed:
AO_INIT_WAIT_OPENinit flag by defining1 << 5in the AO init enum to signal that an AO should emit silence immediately upon open untilao_start().struct buffer_state,init_buffer_post(),ao_play_data(),ao_thread(),ao_reset(),ao_start(), andao_set_paused()by trackingwait_open_silence, starting pull AOs immediately on open, and pacing push-AO silence slices up to ~40 ms delay to stream continuous silent lead-in during--audio-wait-open.reinit_audio_filters_and_output(),ao_chain_reset_state(), andfill_audio_out_buffers()by settingAO_INIT_WAIT_OPEN, guardingao_resume_timeagainst untimed AOs, clearing it on state reset, and holdingSTATUS_SYNCINGviamp_set_timeout()untilao_resume_timeelapses to make--audio-wait-openactually delay playback start.--audio-wait-open=<secs>entry by documenting immediate timed silent lead-in without requiring--audio-stream-silence=yesand noting untimed/encode exclusions to keep user docs accurate.Why this was done:
I frequently encounter issues with outputting HD audio via passthrough mode where high bitrate sections drop-out briefly (<100 ms). This PR pertains specifically to improving user experience when the AV receiver needs a few extra seconds to actually switch into the correct playback mode, which is related to solving "poor AVR <=> mpv performance" in general.
I used Gemini 4 Neon in combination with Antigravity and a microphone-assisted audio testing harness to iterate over these issues. I've manually reviewed the code changes and kept messages clean and sane for human reviewers (though I am copying this exact text in all the PRs).