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

TimeoutException: Failed to start WebCam #664

Closed
DonghwanKIM0101 opened this issue Jul 22, 2022 · 6 comments · Fixed by #668
Closed

TimeoutException: Failed to start WebCam #664

DonghwanKIM0101 opened this issue Jul 22, 2022 · 6 comments · Fixed by #668
Labels
sect:sample app Issue about sample app type:bug Something isn't working

Comments

@DonghwanKIM0101
Copy link
Contributor

DonghwanKIM0101 commented Jul 22, 2022

Plugin Version or Commit ID

v0.10.1

Unity Version

2021.3.3f1

Your Host OS

macOS Monterey 12.4

Target Platform

UnityEditor

Target Device

MacBook Pro (16-inch, 2019)

[Windows Only] Visual Studio C++ and Windows SDK Version

No response

[Linux Only] GCC/G++ and GLIBC Version

bazel: 5.0.0
gcc, g++: 13.1.6
python: 3.9.10

[Android Only] Android Build Tools and NDK Version

No response

[iOS Only] XCode Version

No response

Build Command

python3.9 build.py build --desktop cpu -vv

Bug Description

The situation is quite simple to #392

However, my MacBook is Intel Mac and I can't find TextureFrame#ChangeNameFrom.

Also, I put Debug.Log in TexutreFrame#GetNativeTexturePtr, but it isn't called.

Importantly, the error is occurred without scene change.

Sometimes, I can see the web cam screen in the first scene (face detection), and when I change to other scene the error is occurred, but almost all errors occur first scene that means I can't see the web cam screen at all.

  • When I build old version; 0.9.1 and run in unity 2020.3.~~, it works well.

Steps to Reproduce the Bug

  1. Run python3.9 build.py build --desktop cpu -vv
  2. Start Play Mode and the below error occurs.
    TimeoutException: Failed to start WebCam

Log

Editor.log

Screenshot/Video

No response

Additional Context

No response

@DonghwanKIM0101 DonghwanKIM0101 added the type:bug Something isn't working label Jul 22, 2022
@homuler
Copy link
Owner

homuler commented Jul 22, 2022

Sometimes, I can see the web cam screen in the first scene (face detection), and when I change to other scene the error is occurred, but almost all errors occur first scene that means I can't see the web cam screen at all.

This error has been occurring occasionally before, but I agree that it's happening more often than before.
If this error occurs, it is usually necessary to restart UnityEditor.

@homuler homuler added the sect:sample app Issue about sample app label Jul 22, 2022
@DonghwanKIM0101
Copy link
Contributor Author

DonghwanKIM0101 commented Jul 23, 2022

I edit timeoutFrame in WebCamSource#WaitForWebCamTexture from 500 to 5000, and the frequency of errors has been significantly reduced.

I close the issue, but I wonder this approach is proper way to handle the error.

@homuler
Copy link
Owner

homuler commented Jul 23, 2022

Thank you!
Hmm, that's interesting.

In my case (on Linux Desktop), when it happens, it happens often, and when it doesn't, it doesn't happen at all (and now I happen to be unable to reproduce it at all).
Can you tell me how much the count will eventually go up in your environment?

yield return new WaitUntil(() => count++ > timeoutFrame || webCamTexture.width > 16);

@DonghwanKIM0101
Copy link
Contributor Author

DonghwanKIM0101 commented Jul 23, 2022

I'm not sure this result is helpful, but I test it several times.

1. start scene: 768
2. change scene: 726
3. change scene: 757
4. change scene: 704
5. change scene: 722
6. restart unity editor: 756
7. change scene: 700
8. change scene: 747
9. change scene: 710
10. change scene: 744
11. stop and re-play (without restarting editor): 615
12. change scene: 720
13. change scene: 712
14. change scene: 739
15. change scene: 785

@homuler
Copy link
Owner

homuler commented Jul 23, 2022

Thanks!
It seems that timeoutFarme should be at least about 2000.
If you send me a PR, I'll merge it.

@yalegria
Copy link

yalegria commented Feb 9, 2023

I encountering this issue too. I am on Mac OS M1.

I got it to go away by setting timeoutFrame to 3000. It seems that 2000 is too low.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sect:sample app Issue about sample app type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants