i-rinat / freshplayerplugin

ppapi2npapi compatibility layer
MIT License
728 stars 52 forks source link

audio input via pulse is very slow #290

Closed msalle closed 8 years ago

msalle commented 8 years ago

When using freshplayer using pulseaudio, audio input is extremely slow (unusable). Disabling pulse and running via alsa works fine. Running the pepperflash plugin directly (via chromium) works fine both using pulse and alsa. See e.g. https://www.onlinemictest.com/microphone-test-in-adobe-flash to test.

i-rinat commented 8 years ago

audio input is extremely slow

Could you be more specific about "slow"? What does it mean? Sample rate doesn't match?

I used to use https://i-rinat.github.io/flash-test-cases/RecordAudio/index.html to make tests. That test app first records for five seconds from microphone, then plays recorded samples. Does it work well?

msalle commented 8 years ago

It misses a lot of input, about half the input I would say (saying 5x test results in only 2-3), a bit like working on a very slow old computer. The flash testpage I linked shows also something like only half time audio getting through, while the other half just seems to be dropped and the visualization is very slow there (which it is not on a 'native' pepperflash plugin) with a screen refresh only once every second or so instead of continuously. This was also what I experienced in a adobeconnect meeting I was in this afternoon, the audio output was fine, but the audio input was stuttered and slow.

i-rinat commented 8 years ago

Test app you gave link to, also freezes in Chrome on my machine.

And I realized I didn't try to capture longer than five seconds of sound. I think I need to make another test app to check whenever it's that app was broken or Flash itself acts that way.

msalle commented 8 years ago

Ah, that's annoying... Longer samples certainly might be useful for debugging. I found http://www.adobe.com/devnet/flash/articles/flcs5_features_microphone_event.html which might have been used by the one writing it.

i-rinat commented 8 years ago

Created MicrophoneOscilloscope test. I didn't like the test app from title message because it painted only sample from immediate capture, without storing a number of them for visual history. Does it work on your machine? I didn't notice any freezes on mine.

msalle commented 8 years ago

I've created screencaptures (xvidcap) for Firefox using alsa and pulse, plus one for chromium, see https://surfdrive.surf.nl/files/public.php?service=files&t=b591b37ccf5c62fb3c1a567d0495c539 (The link will expire at the end of the year).

i-rinat commented 8 years ago

As far as I understand, PulseAudio tries to maximize latency, unless requested otherwise. I've changed the way capture streams created in 4ef12af9aa95e866c3609c097c3a054b8692c9b2. Could you test whenever that gives any positive effects?

msalle commented 8 years ago

Yes it does! Works perfectly. Many thanks for the quick fix! (and no, I don't like pulse (-; ) For completeness I've uploaded two captures from both your test and the other microphone test to https://surfdrive.surf.nl/files/public.php?service=files&t=b591b37ccf5c62fb3c1a567d0495c539 two files called pulse_master.mpeg and pulse_master2.mpeg.

i-rinat commented 8 years ago

OK, that's great.