Skip to content

Commit

Permalink
less scary message when we can't load webcam components
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Oct 9, 2022
1 parent f5426a0 commit ca5b4d8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions xpra/server/mixins/webcam_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,19 @@ def init_webcam(self):
if not self.webcam_enabled:
return
try:
# pylint: disable=import-outside-toplevel
from xpra.codecs.pillow.decoder import get_encodings
except ImportError:
log("init_webcam()", exc_info=True)
log.info("webcam forwarding cannot be enabled without the pillow decoder")
self.webcam_enabled = False
return
try:
self.webcam_encodings = tuple(x for x in ("png", "jpeg", "webp") if x in get_encodings())
except Exception as e:
log("init_webcam()", exc_info=True)
log.error("Error: webcam forwarding disabled:")
log.error(" %s", e)
log.estr(e)
self.webcam_enabled = False
if self.webcam_device:
self.webcam_virtual_video_devices = 1
Expand All @@ -85,12 +93,13 @@ def init_virtual_video_devices(self):
log("init_virtual_video_devices")
if not POSIX or OSX:
return 0
# pylint: disable=import-outside-toplevel
try:
from xpra.codecs.v4l2.pusher import Pusher
assert Pusher
except ImportError:
log("failed to import the virtual video module", exc_info=True)
log.info("no v4l2 virtual video module")
log.info("webcam forwarding requires the v4l2 virtual video module")
return 0
try:
from xpra.platform.xposix.webcam import get_virtual_video_devices, check_virtual_dir
Expand Down

0 comments on commit ca5b4d8

Please sign in to comment.