From 89309215c39cb7f9d4db7ae2760840d6655f1088 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 17 Jan 2024 22:59:57 +0100 Subject: Fix stuttering audio on pipewire + opus + multiple audio sources merged --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 02c6abd..21f5f8c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2265,7 +2265,8 @@ int main(int argc, char **argv) { for(AudioDevice &audio_device : audio_track.audio_devices) { audio_device.thread = std::thread([&]() mutable { const AVSampleFormat sound_device_sample_format = audio_format_to_sample_format(audio_codec_context_get_audio_format(audio_track.codec_context)); - const bool needs_audio_conversion = audio_track.codec_context->sample_fmt != sound_device_sample_format; + // TODO: Always do conversion for now. This fixes issue with stuttering audio on pulseaudio with opus + multiple audio sources merged + const bool needs_audio_conversion = true;//audio_track.codec_context->sample_fmt != sound_device_sample_format; SwrContext *swr = nullptr; if(needs_audio_conversion) { swr = swr_alloc(); @@ -2313,6 +2314,7 @@ int main(int argc, char **argv) { received_audio_time = this_audio_frame_time; if(paused) { + received_audio_time = this_audio_frame_time; if(!audio_device.sound_device.handle) usleep(timeout_ms * 1000); continue; -- cgit v1.2.3