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 sometimes has 1-2 second lag until virtual_oss is restarted #19

Open
cullumsmith opened this issue Jan 13, 2025 · 1 comment
Open

Comments

@cullumsmith
Copy link

I have a pretty basic setup: USB speakers and a webcam microphone. I use virtual_oss to use them both simultaneously via /dev/dsp:

virtual_oss_enable="YES"
virtual_oss_dsp="-T /dev/sndstat -C 2 -c 2 -S -r 48000 -b 16 -s 100ms -O /dev/dsp1 -R /dev/dsp0 -d dsp -t vsdp.ctl"

(After experimentation, I had to set a very large buffer size to prevent crackling/distortion during video chats...perhaps this is related to the problem?)

Occasionally, virtual_oss gets into a bad state where the audio coming out of the speakers has a 1-2 second lag behind the application. This is most noticeable when playing a video, as the audio is totally out of sync.

Running service virtual_oss restart fixes the problem until it returns a few days later.

My setup:

FreeBSD 14.2-RELEASE amd64
virtual_oss-1.3.1_2

Playback device:

ugen0.4: <vendor 0x0a12 product 0x4010> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x0a12 product 0x4010, class 9/0, rev 2.00/15.49, addr 14> on usbus0
uhub1: 4 ports with 0 removable, bus powered
ugen0.5: <Audioengine LLC Audioengine 2+> at usbus0
uaudio1 on uhub1
uaudio1: <Audioengine LLC Audioengine 2+, class 0/0, rev 2.00/14.86, addr 15> on usbus0
uaudio1: Play[0]: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer. (selected)
uaudio1: Play[0]: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio1: Play[0]: 32000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio1: Play[0]: 22050 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio1: Play[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio1: Play[0]: 8000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio1: No recording.
uaudio1: No MIDI sequencer.
pcm1 on uaudio1
uaudio1: No HID volume keys found.
uhid0 on uhub1
uhid0: <Audioengine LLC Audioengine 2+, class 0/0, rev 2.00/14.86, addr 15> on usbus0

Recording device:

ugen0.2: <vendor 0x046d HD Pro Webcam C920> at usbus0
uaudio0 on uhub0
uaudio0: <vendor 0x046d HD Pro Webcam C920, class 239/2, rev 2.00/0.21, addr 20> on usbus0
uaudio0: No playback.
uaudio0: Record[0]: 32000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer. (selected)
uaudio0: Record[0]: 24000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio0: Record[0]: 16000 Hz, 2 ch, 16-bit S-LE PCM format, 2x4ms buffer.
uaudio0: No MIDI sequencer.
pcm0 on uaudio0
@cullumsmith
Copy link
Author

cullumsmith commented Feb 14, 2025

I replaced my webcam with an (ironically) cheaper model that supports 48000 Hz (to match the output sample rate), and reduced the buffer size to 4ms, and the issue appears to have resolved. I suppose it was related to resampling?

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

1 participant