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 stuttering on macOS since v0.37.0 #13880

Closed
NextFire opened this issue Apr 13, 2024 · 12 comments · Fixed by #13902
Closed

Audio stuttering on macOS since v0.37.0 #13880

NextFire opened this issue Apr 13, 2024 · 12 comments · Fixed by #13902

Comments

@NextFire
Copy link

NextFire commented Apr 13, 2024

Possibly related issues/PRs:
#13676
#12643 (comment)
#13348

Important Information

Provide following Information:

  • mpv version: v0.37.0-775-g9030e6a7ad
  • macOS Version: 14.4.1 (23E224)
  • Source of the mpv binary or bundle: binary, compiled from source
  • If known which version of mpv introduced the problem: v0.37.0
  • Possible screenshot or video of visual glitches: N/A

Reproduction steps

mpv <any file> --no-config

Expected behavior

No audio stuttering.

Actual behavior

Audio stutters every 20 to 60 seconds when playing any file.

I also get these kinds of errors in the macOS console:

  • Healer Girl 05 (CR)
Capture d’écran 2024-04-13 à 17 17 37 Capture d’écran 2024-04-13 à 17 21 35

Log file

mpv.log

(There were stutters at 0:30 and 0:40 but nothing relevant was logged)

Sample files

N/A

@NextFire NextFire changed the title Audio stuttering on macOS since v0.37.0 Audio stuttering on macOS since v0.38.0 Apr 13, 2024
@NextFire NextFire changed the title Audio stuttering on macOS since v0.38.0 Audio stuttering on macOS since v0.37.0 Apr 13, 2024
@NextFire
Copy link
Author

NextFire commented Apr 13, 2024

Sorry for the confusion, I believe 0.37 introduced the bug as I downgraded to 0.36 and am no more able reproduce the issue

@m154k1
Copy link
Contributor

m154k1 commented Apr 14, 2024

Can you try reverting 36d5b52 and see if that helps?

@NextFire
Copy link
Author

I can confirm reverting this commit resolved the issue

@Dudemanguy
Copy link
Member

Probably worth reverting before the next release. I think there are various reports of audio issues that caused on macOS. cc @Akemi.

@Akemi
Copy link
Member

Akemi commented Apr 16, 2024

i suppose we could do that. what was the reasoning behind using/introducing ao_read_data_nonblocking?

@kasper93
Copy link
Contributor

It was introduced to avoid locking audio thread. /CC @t-8ch

@m154k1
Copy link
Contributor

m154k1 commented Apr 16, 2024

Note: ao_read_data_nonblocking works fine for avfoundation ao. Maybe this can help:

int real_sample_count = ao_read_data_nonblocking(ao, data, request_sample_count, end_time_av - cur_time_av + cur_time_mp + time_delta);
if (real_sample_count == 0) {
// avoid spinning by blocking the thread
mp_sleep_ns(10000000);
goto finish;
}

@kasper93
Copy link
Contributor

huh, just use ao_read_data at this point...

@Akemi
Copy link
Member

Akemi commented Apr 16, 2024

It was introduced to avoid locking audio thread. /CC @t-8ch

so it should possibly be reinvestigated in the future?

@t-8ch
Copy link
Contributor

t-8ch commented Apr 16, 2024

The nonblocking variant was introduced specifically for ao_pipewire as it uses a realtime audio thread, which should not be blocked.

I extended the usage to other AOs that are capable of reporting the actually available number of samples to the audio server.

If it does not work work for those other AOs should be fine to revert it.

@t-8ch
Copy link
Contributor

t-8ch commented Apr 16, 2024

I would be interested however why there is only one report so far.
(There was also one similar report for ao_pipewire)

It only seems to happen for very few people.

@NextFire
Copy link
Author

Thank you!

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 a pull request may close this issue.

6 participants