GNOME Bugzilla – Bug 764298
wasapi: does not work at all
Last modified: 2018-11-03 13:48:15 UTC
gst-launch-1.0.exe -e wasapisrc ! wasapisink Expected result: echo. Actual result: pipeline starts. I can hear nothing.
https://bugzilla.gnome.org/show_bug.cgi?id=689691
There are various problems with the wasapi plugin, yes, starting with proper negotiation of the audio format.
I have written a patchset. The plugin works again, but not without its quirks. The largest remaining bug is that it hangs when stopping. On the crack side of things, patch 5 adds a BYTE overflow[10240] that handles the odd read lengths requested at buffer wraparounds. If wasapi has 960 samples available, each 32-bit stereo, that's 7680 bytes. If the length passed to the read function is less than that, we put the remaining bytes in the overflow buffer, and write them out on the next pass. Especially the hardcode of 10240 is bad here, although by my arithmetics we should never see numbers above 7672 bytes here. For now, the format is not negotiated, you have to specify a cap that your driver supports. E.g. wasapisrc loopback=true dev-type=multimedia ! audio/x-raw,format=S16LE,rate=48000,channels=1 might fail on a system with 44.1khz stereo output.
Created attachment 331880 [details] [review] 0001-wasapisrc-Actually-return-caps.patch
Created attachment 331881 [details] [review] 0002-wasapisrc-Allow-choosing-format.patch
Created attachment 331882 [details] [review] 0003-wasapisrc-Fix-functions-returning-FALSE-on-success.patch
Created attachment 331883 [details] [review] 0004-wasapisrc-add-some-error-handling.patch
Created attachment 331884 [details] [review] 0005-wasapisrc-Use-polling-rather-than-event-driven-I-O.patch
Created attachment 331885 [details] [review] 0006-wasapisrc-Handle-reported-silence.patch
Created attachment 331886 [details] [review] 0007-wasapisrc-Log-buffer-flags-in-a-useful-manner.patch
Created attachment 331887 [details] [review] 0008-wasapisrc-Add-loopback-and-device-type-selection.patch
Created attachment 331888 [details] [review] 0009-wasapisrc-update-example-to-show-typical-usage.patch
(In reply to Morten M Neergaard from comment #3) > I have written a patchset. The plugin works again, but not without its > quirks. > > The largest remaining bug is that it hangs when stopping. This was happening in my build from master, but isn't happening in my current build. Not sure why, but pressing ctrl+c now in a complete pipeline with screen capture + audio loopback capture quits promptly.
Over the past couple of weeks I've pushed patches to the wasapi plugin that make it actually work. I've gone through your patches and almost everything in there is fixed in git now. The only thing remaining is handling silent buffers in wasapisrc. See also: https://bugzilla.gnome.org/show_bug.cgi?id=792897 Could you please try the latest code in -bad and confirm this?
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/363.