Skip to content

Fixed major issues with dependencies, camera controller, speedtest not working#3

Open
JugglerMaster wants to merge 3 commits into
Zedstron:mainfrom
JugglerMaster:main
Open

Fixed major issues with dependencies, camera controller, speedtest not working#3
JugglerMaster wants to merge 3 commits into
Zedstron:mainfrom
JugglerMaster:main

Conversation

@JugglerMaster

Copy link
Copy Markdown

Summary

Fixes camera not showing live feed, startup hangs on headless systems, and missing build dependencies for ARM64.

Changes

🎥 Camera: Enable at startup + fix black screen

Files: src/main.py, src/controllers/camera.py

  • The CameraController was instantiated but enable() was never called — get_frame() always returned a noise/black fallback frame. Added camera.enable() with error handling at startup.
  • get_frame() had no return in the success path of the try/except block. When capture_array() succeeded, the function returned None implicitly, causing a black screen in the WebRTC video track.

🔊 WhiteNoisePlayer: Handle missing audio hardware

File: src/controllers/whitenoise.py

  • pyaudio.PyAudio() called without error handling hangs indefinitely on systems without working audio (e.g. headless Raspberry Pi). Wrapped in try/except so self.p is None on failure.
  • Added hasattr(self, 'stream') guards to prevent AttributeError when __openSpeaker() was never called or failed.
  • Removed buggy __close() method that had infinite recursion (stop()__close()stop()) and accessed self.stream after closing.

⏱ Speed test: Add timeout to prevent startup hang

File: src/utils.py

  • quick_speed_test() uses speedtest-cli which can hang indefinitely on networks with no internet or poor connectivity. Wrapped the test in a ThreadPoolExecutor with a 15-second timeout so the server starts regardless.

📦 packages.txt: Add build deps for ARM64

File: src/packages.txt

  • pyaudio fails to pip install on aarch64 because portaudio.h is missing. Added portaudio19-dev (headers) and python3-dev (build tools) so the C extension compiles successfully.

christopherjuggler added 3 commits July 2, 2026 13:38
- Enable camera at startup with error handling (was never called)
- Add missing return in camera.get_frame() success path (was returning None, causing black screen)
- Wrap PyAudio init in whitenoise with try/except to prevent hangs
- Add 15s timeout to quick_speed_test() to prevent startup blockage
- Fix whitenoise __close method (recursion and attribute bugs)
- Create media/audio directory if missing
pip install pyaudio from source requires portaudio.h (from portaudio19-dev).
Also add python3-dev for build tools and enable --system-site-packages
in the venv so system-installed packages (picamera2, etc.) are accessible.
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

Successfully merging this pull request may close these issues.

1 participant