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

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called on Windows 7 #3825

Closed
2 tasks done
Falcosoft opened this issue Mar 16, 2023 · 19 comments

Comments

@Falcosoft
Copy link

Falcosoft commented Mar 16, 2023

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Windows 7 x86/x64
  • scrcpy version: 2.0
  • installation method: Windows release
  • device model: Model independent error.
  • Android version: 12

After starting scrcpy-console on Windows 7 x86 or Windows 7 x64 the following error is written to console and the client is closed:
ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called.
ERROR: Demuxer error
WARN: Killing the server...

It seems to be an SDL2 error. The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio.
The solution could be to add CoInitialize() call to the client.

@rom1v
Copy link
Collaborator

rom1v commented Mar 16, 2023

The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio.

Even with the new option --audio-output-buffer=10 on the dev branch (not to be confused with --audio-buffer=)?

See #3793 (comment)

@Falcosoft
Copy link
Author

Falcosoft commented Mar 16, 2023

The workaround to use other SDL2 audio driver like winmm or directsound does not work with srccpy since regardless of the buffer size you only get static/garbled audio.

Even with the new option --audio-output-buffer=10 on the dev branch (not to be confused with --audio-buffer=)?

See #3793 (comment)

Can you provide an x86 Windows binary so I can test it? I cannot test the x64 Windows version on Windows 7 at the moment.

@rom1v
Copy link
Collaborator

rom1v commented Mar 16, 2023

Here is a x86 build for the current dev branch:

@Falcosoft
Copy link
Author

Thanks,
with this new version of scrcpy.exe the following workaround produces good quality audio (scrcpy-console.bat):

@echo off
set SDL_AUDIODRIVER=directsound
scrcpy.exe --audio-output-buffer=10

@Irupc
Copy link

Irupc commented Apr 12, 2023

Are there any solutions for this "could not open audio device: WASAPI can't initialized audio client " Error ?

@rom1v
Copy link
Collaborator

rom1v commented Apr 12, 2023

See #3856 (comment)

@rom1v
Copy link
Collaborator

rom1v commented Jun 14, 2023

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called.

So it's presumably fixed in SDL 2.28 (see libsdl-org/SDL#7478).
SDL 2.28 RC1 has just been released, so let's try (branch sdl_2_27_1).

Please test this version and confirm that the WASAPI issue is fixed (or not):

@Falcosoft
Copy link
Author

Falcosoft commented Jun 14, 2023

Hi,
I have tested the new binary and SDL version on Windows 7 x64. There are no more error messages and the audio works perfectly (presumably with WASAPI since I used scrcpy-console.bat from the new zip without any modifications).

@rom1v
Copy link
Collaborator

rom1v commented Jun 14, 2023

Awesome, thank you for your test 👍

@rom1v rom1v closed this as completed in 09009c2 Jun 21, 2023
@vashviS
Copy link

vashviS commented Jun 22, 2023

not working on my andriod 13 iqoo z6

@rom1v
Copy link
Collaborator

rom1v commented Jun 22, 2023

@vashviS What is the full output in the console when you run scrcpy?

@rom1v
Copy link
Collaborator

rom1v commented Jun 22, 2023

@Falcosoft I didn't ask, but does it still work for you in the final scrcpy v2.1?

@vashviS
Copy link

vashviS commented Jun 22, 2023

@vashviS What is the full output in the console when you run scrcpy?

scrcpy 2.0 https://github.com/Genymobile/scrcpy
C:\Users\vashvi\Downloads\scrcpy-win64-v2.0-92-g7a41cb3e9... file pushed, 0 skipped. 48.7 MB/s (57927 bytes in 0.001s)
[server] INFO: Device: vivo I2127 (Android 13)
INFO: Renderer: direct3d
INFO: Texture: 1080x2408
[server] INFO: newMaxSize = 1920
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
[server] ERROR: Encoding error: java.lang.IllegalArgumentException: null
INFO: Texture: 864x1920
INFO: Texture: 1920x864
ERROR: Could not open audio device: WASAPI can't find requested audio endpoint: Element not found.
ERROR: Demuxer error
WARN: Killing the server...
Press any key to continue . . .

@vashviS
Copy link

vashviS commented Jun 22, 2023

os windows 10 64bit

@vashviS
Copy link

vashviS commented Jun 22, 2023

ERROR: Could not open audio device: WASAPI can't initialize audio client: CoInitialize has not been called.

So it's presumably fixed in SDL 2.28 (see libsdl-org/SDL#7478). SDL 2.28 RC1 has just been released, so let's try (branch sdl_2_27_1).

Please test this version and confirm that the WASAPI issue is fixed (or not):

did not worked just crashes after 10 sec

@rom1v
Copy link
Collaborator

rom1v commented Jun 22, 2023

did not worked just crashes after 10 sec

Oh, so initially it worked, but then it failed?

Could you please try with audio only (and on scrcpy v2.1 please):

scrcpy --no-video

@vashviS
Copy link

vashviS commented Jun 22, 2023

sure

@rom1v
Copy link
Collaborator

rom1v commented Jun 22, 2023

@vashviS Btw, given the stack trace, it is a different issue as this one. You shoud open a new issue.

@Falcosoft
Copy link
Author

@Falcosoft I didn't ask, but does it still work for you in the final scrcpy v2.1?

Yes, it is also working in the final v2.1.

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