Fixed some sound and threading issues.

Details:
* Switched SDL audio mutex to RW lock. This fixes games that continiously call SetVolume in a different thread (like Ghostbusters)
* Added contition to buffer audio packets independent of video packets. This fixes choppy audio across many games.
* Increased the number of audio frame buffers from 2 to 4. Just in case.
* Migrated to std::jthread and std::mutex from pthreads.
* Fixed a race condition with joins on avplayer close that caused a crash.
This commit is contained in:
Vladislav Mikhalin 2024-08-14 21:30:44 +03:00
parent e33ff10212
commit 0d6e8e227a
17 changed files with 231 additions and 481 deletions

View file

@ -234,7 +234,7 @@ int PS4_SYSV_ABI sceAudioOutGetSystemState() {
}
int PS4_SYSV_ABI sceAudioOutInit() {
LOG_INFO(Lib_AudioOut, "called");
LOG_TRACE(Lib_AudioOut, "called");
if (audio != nullptr) {
return ORBIS_AUDIO_OUT_ERROR_ALREADY_INIT;
}
@ -323,12 +323,10 @@ int PS4_SYSV_ABI sceAudioOutOpenEx() {
}
s32 PS4_SYSV_ABI sceAudioOutOutput(s32 handle, const void* ptr) {
LOG_TRACE(Lib_AudioOut, "called");
return audio->AudioOutOutput(handle, ptr);
}
int PS4_SYSV_ABI sceAudioOutOutputs(OrbisAudioOutOutputParam* param, u32 num) {
LOG_TRACE(Lib_AudioOut, "called");
for (u32 i = 0; i < num; i++) {
if (auto err = audio->AudioOutOutput(param[i].handle, param[i].ptr); err != 0)
return err;