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

Rage input hook stops updating keyboard key states after CEF userMedia output stream for audio is created #2815

Open
Explooosion-code opened this issue Sep 24, 2024 · 0 comments
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@Explooosion-code
Copy link
Contributor

Explooosion-code commented Sep 24, 2024

What happened?

Whenever you create a CEF userMedia output stream in a NUI resource ex:

navigator.mediaDevices
    .getUserMedia({ video: false, audio: {} })
    .then((stream) => {
        const source = this.audioCtx.createMediaStreamSource(stream);
        console.log(source);
    })
    .catch((err) => {
        console.log(err)
    });

It freezes the GlobalInputHandlerLocal::WndProc and so no GlobalInputHandlerLocal::KeyboardMessage is ever fired.
code/components/rage-input-five/src/GlobalInput.cpp

This could mean that FiveM thinks that some keys are pressed when they are not or vice versa. Especially because mumble checks
for that control usage for either in-game controls or the InputHook controls and your voice will get stuck if the stream is created after you start talking.

I've done some debugging myself and traces show that:

Windows API call received
Key 32 is now UP
Windows API call received
Key 68 is now DOWN
Windows API call received
Key 68 is now DOWN
Windows API call received
Key 68 is now UP
Windows API call received
Key 68 is now DOWN
Windows API call received
Key 68 is now UP
Windows API call received
Key 68 is now DOWN
Windows API call received
Key 68 is now UP
Windows API call received
Key 87 is now UP
Windows API call received
Key 160 is now UP
Windows API call received
Keyboard message for voice: true
Key 222 is now DOWN 

vKey 222 is my bind for push to talk and I create the stream at the first PTT usage. After 222 key is pressed down - userMedia stream is created - its never lifted UP and no further events are passed by windows.

I have not done enough audio programming to have an intuition as to why that may be. Maybe two sources - mumble and NUI trying to get the same data and corrupting something? Maybe something is eternally waiting for some mutex to unlock?

Maybe someone that knows the codebase a little better can find/give me ideas where to find problems and solutions?

Expected result

The rage input hook should keep updating states

Reproduction steps

  1. Create userMedia output for audio when clicking the Push to talk button

Importancy

Slight inconvenience

Area(s)

FiveM

Specific version(s)

3258, 3095 FIVEM

Additional information

No response

@Explooosion-code Explooosion-code added bug triage Needs a preliminary assessment to determine the urgency and required action labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant