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

audio-stream-silence works only for short pause #3754

Closed
arvidjaar opened this issue Oct 31, 2016 · 8 comments
Closed

audio-stream-silence works only for short pause #3754

arvidjaar opened this issue Oct 31, 2016 · 8 comments

Comments

@arvidjaar
Copy link

mpv version and platform

0.21.0, Ubuntu 16.04, kernel 4.8.0-25,
00:1b.0 Audio device [0403]: Intel Corporation Wildcat Point-LP High Definition Audio Controller [8086:9ca0] (rev 03)
Subsystem: Dell Wildcat Point-LP High Definition Audio Controller [1028:062b]
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel

0 [HDMI ]: HDA-Intel - HDA Intel HDMI
HDA Intel HDMI at 0xf733c000 irq 52
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7338000 irq 51

Reproduction steps

Set

audio-stream-silence=yes

Start video playback on HDMI connected TV. Pause playback. Wait several minutes and resume.

Expected behavior

There is no silence when playback starts.

Actual behavior

There is initial silence when playback starts, especially annoying when some dialogue is going on. This does not happen for short pause (several seconds) where audio resumes instantly.

Log file

https://gist.github.com/arvidjaar/0a06e2394d8e4f76918255f998185631

Sample files

Any normal video stream

@ghost
Copy link

ghost commented Nov 18, 2016

There is no silence when playback starts.

You'd need to combine it with --audio-wait-open=. --audio-stream-silence merely streams silence when no audio is playing, while adding --audio-wait-open would "prime" the audio device with silence before sending real audio data to it.

Unfortunately, --audio-stream-silence is not implemented for Pulse, only alsa/wasapi/coreaudio/jack/sdl. ao_alsa implements it by special API usage (makes it stream silence on underflow), so this is not necessarily easy to add to Pulse.

But in general I'd expect Pulse server to handle this, due to its aspiration of "doing the right thing" and managing audio devices directly, rather than leaving it to applications.

@ghost
Copy link

ghost commented Nov 18, 2016

(Actually looking again you enable --audio-wait-open.)

@arvidjaar
Copy link
Author

Unfortunately, --audio-stream-silence is not implemented for Pulse

Well, would be helpful if it also said so, at least in verbose mode :) I'll try to raise it up with PA.

@ghost
Copy link

ghost commented Nov 18, 2016

Well, the manpage says Not all AOs support this..

ghost pushed a commit that referenced this issue Nov 24, 2016
Until now, this was only implemented for ao_alsa and AOs not using
push.c. ao_alsa.c relied on enabling funny underrun semantics for
avoiding resets on lower levels, while other AOs using push.c didn't do
anything.

Change this and at least make push.c copy silent data to the AO. This
still isn't perfect as keeping track of how much silence was played when
seems complex, so we don't do it. The consequence is that frame-stepping
will essentially randomize the A/V offset (it'll recover immediately
when unpausing, but still ugly). Also, in order to empty the currently
buffered audio on seeks etc., we still call ao_driver->reset and so on,
so the AO driver will still need to handle this specially.

The intent is to make behavior with ALSA less weird (for one we can
remove the code in ao_alsa.c that tries to trigger an initial
underflow). Also might help with #3754.
@ghost
Copy link

ghost commented Nov 24, 2016

Pushed a change that will cause ao_pulse.c to explicitly play silence as well. Also will probably lead to new problems.

@arvidjaar
Copy link
Author

Thanks! Will have to wait until next release to test and report.

@ghost
Copy link

ghost commented Nov 24, 2016

The next release is probably in a few months.

@arvidjaar
Copy link
Author

I tried mpv at commit 51fd8f6 - as far as I understand it should include this change. It did not help, I still see the same lack of sound after resuming from pause with PA. With ALSA there is no gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants