aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-01-17 22:59:57 +0100
committerdec05eba <dec05eba@protonmail.com>2024-01-17 22:59:57 +0100
commit89309215c39cb7f9d4db7ae2760840d6655f1088 (patch)
treeec681e04c2539c203c7334846609aa3d924acde4 /src/main.cpp
parentfc38c6edb6fa36fa77f7ab77e4bddcb2f042e1af (diff)
Fix stuttering audio on pipewire + opus + multiple audio sources merged
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp4
1 files changed, 3 insertions, 1 deletions
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;