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 cutout after 20 minutes, and again about 40 minutes #42

Open
oparada1988 opened this issue Dec 20, 2023 · 26 comments
Open

Audio cutout after 20 minutes, and again about 40 minutes #42

oparada1988 opened this issue Dec 20, 2023 · 26 comments

Comments

@oparada1988
Copy link

Hi Team,

Pipewire 1.0.0
Focusrite 2i2 3rd Gen
2x Elgato Wave XLR
OBS 30.0.1
Ubuntu 22.04.3
6.2.0-1018-lowlatency

So This is on a new fresh install of the OS, I had this on my previous install and did a new install to see if I could recreate it. So, within 21 minutes of recording I get this audio cut out, it also happens later on around 40 minutes. and wanted to see if anyone has experienced this before?

https://obsproject.com/tools/analyzer?log_url=https%3A%2F%2Fobsproject.com%2Flogs%2FDoBGdIdaHcqvLTMr

qpwgraph:

Screenshot from 2023-12-20 15-19-22

recording sample:

Audio.Cutout.OBS.mp4
@dimtpap
Copy link
Owner

dimtpap commented Dec 20, 2023

It sounds like under/overrunning. What's PipeWire's quantum set to? (https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-buffer-size-quantum)

@oparada1988
Copy link
Author

Sorry, I was our for the xmas holiday. Looking at /etc/pipewire/pipewire.conf I do not have this file. Should I proceed and create it with the values in the guide?

default.clock.min-quantum = 32
default.clock.max-quantum = 8192

Or, since there is no client specified should I do the one stated?

default.clock.quantum = 1024

@dimtpap
Copy link
Owner

dimtpap commented Dec 26, 2023

See https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#configuration-file-pipewireconf
then try setting default.clock.min-quantum to 64, 128 etc and see if it happens again

@oparada1988
Copy link
Author

See https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#configuration-file-pipewireconf then try setting default.clock.min-quantum to 64, 128 etc and see if it happens again

Done, will report back :-)

@oparada1988
Copy link
Author

Hi, I recorded a 1:30:00 podcast episode and the issue occured. I will proceed to chnage the value from 64 to 128. Please keep this open and will update as I go along. Next recording that I will be making is next week.

@oparada1988
Copy link
Author

on OBS I have it set to 48khz for audio. thought id mention this in case anyone has any input.

@dimtpap
Copy link
Owner

dimtpap commented Dec 30, 2023

Does it happen in general or only with your podcast recording setup? If you replicate the issue could you also provide a screenshot of pw-top while you're recording? Thanks

@oparada1988
Copy link
Author

tbh only with my podcast recording set up, I havent recorded anything else. I will do pw-top during the next recording and will share here.

@oparada1988
Copy link
Author

Screenshot from 2024-01-03 07-30-48

As requested

@dimtpap
Copy link
Owner

dimtpap commented Jan 4, 2024

Quantum is reasonable on everything so there's no need to try other quantums in your config. It's most definitely a bug.

Unrelated suggestion: You seem to be rerouting audio manually with qpwgraph from single ports to stereo audio input sources. You may want to consider pipewire-jack and OBS's JACK input sources. They're a much better fit for custom routing

@dimtpap
Copy link
Owner

dimtpap commented Jan 5, 2024

In fact, could you try with a JACK Input Client source next time? The code I'm suspecting to be the problem is pretty much the same in both, I want to see if it's problematic in general or if there's something wrong just here

@oparada1988
Copy link
Author

Interestingly, when I tried using Jack it doesnt even appear in the qjackctl graph for me to route it. I went ahead and deleted the Pipewire input capture

Screenshot from 2024-01-05 08-04-34

Screenshot from 2024-01-05 08-05-19

@dimtpap
Copy link
Owner

dimtpap commented Jan 5, 2024

They should show up in qpwgraph if you have pipewire-jack installed

@oparada1988
Copy link
Author

Same thing, I select jack input client and it doesnt show up in qpwgraph :-(

pipewire-jack is also installed on my system:

Screenshot from 2024-01-05 16-34-02

2024-01-05.16-31-37.mp4

@dimtpap
Copy link
Owner

dimtpap commented Feb 1, 2024

Taking a shot in the dark. Can you try with this build?
Diff:

diff --git a/src/pipewire-audio.c b/src/pipewire-audio.c
index 95ee923..b43c936 100644
--- a/src/pipewire-audio.c
+++ b/src/pipewire-audio.c
@@ -177,7 +177,17 @@ static void on_process_cb(void *data)
 
 	struct obs_pw_audio_stream *s = data;
 
-	struct pw_buffer *b = pw_stream_dequeue_buffer(s->stream);
+	struct pw_buffer *b = NULL;
+	{
+		struct pw_buffer *t;
+		while ((t = pw_stream_dequeue_buffer(s->stream)) != NULL) {
+			if (b) {
+				pw_stream_queue_buffer(s->stream, b);
+			}
+
+			b = t;
+		}
+	}
 
 	if (!b) {
 		return;

@oparada1988
Copy link
Author

Will do! Sorry about no follow up, been working but we did one more recording and it happens. We will record again this tuesday and I will report back if the issue persists with the above build you shared.

@oparada1988
Copy link
Author

Issue persists, however it happened only once. Is there something else I should be looking for??

@dimtpap
Copy link
Owner

dimtpap commented Mar 25, 2024

Can you try the latest commit?
Build here

@oparada1988
Copy link
Author

Can you try the latest commit? Build here

Heya, Yeah ill try it out today!

@adromel
Copy link

adromel commented May 13, 2024

Hi! For what it's worth, I have the same issue as OP (except that it was much more frequent), and switching to JACK input client did the trick: no more audio stuttering/crackling/popping.

Tried most of what I've found : commit 5c47e1a, switching kernels, niceness, removing easyeffects. None succeeded.
I'm on up-to-date Arch and obs-studio package, and quantum are the same as above.

Edit: So this finally happened with JACK as well, but i got it fixed with this workaround: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3098#note_1823699

Sorry for the false alarm, OPAC is working as intended. Thanks for the useful work that should be merged in obs!

@oparada1988
Copy link
Author

oparada1988 commented Jul 5, 2024

Hi! For what it's worth, I have the same issue as OP (except that it was much more frequent), and switching to JACK input client did the trick: no more audio stuttering/crackling/popping.

Tried most of what I've found : commit 5c47e1a, switching kernels, niceness, removing easyeffects. None succeeded. I'm on up-to-date Arch and obs-studio package, and quantum are the same as above.

Edit: So this finally happened with JACK as well, but i got it fixed with this workaround: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3098#note_1823699

Sorry for the false alarm, OPAC is working as intended. Thanks for the useful work that should be merged in obs!

Im sorry, what exactly did you do? Im reading the issue report and im kinda confused...

I'm on Ubuntu 22.04 btw

@oparada1988
Copy link
Author

oparada1988 commented Aug 9, 2024

Im about to give up, im still having this issue. I tried Jack and same thing. I really dont want to move back to windows for this little thing :-( if anyone else has any other suggestions please let me know

@alterNERDtive
Copy link

I’ve been having similar crackling issues with my mic (completely unrelated to this plugin, btw). Seems to be solved for me, hasn’t happened in weeks; I just set a fixed PIPEWIRE_LATENCY for OBS.

@oparada1988
Copy link
Author

I’ve been having similar crackling issues with my mic (completely unrelated to this plugin, btw). Seems to be solved for me, hasn’t happened in weeks; I just set a fixed PIPEWIRE_LATENCY for OBS.

Can you provide some steps or guide on what you did?

@dimtpap
Copy link
Owner

dimtpap commented Aug 10, 2024

@oparada1988 PIPEWIRE_LATENCY is an environment variable. The PipeWire README explains it.

@dimtpap
Copy link
Owner

dimtpap commented Sep 3, 2024

Can you try with a build from here? Under "artifacts"

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

No branches or pull requests

4 participants