diff --git a/examples/face_landmark/face_landmark.py b/examples/face_landmark/face_landmark.py index b61d8169..edc20f36 100644 --- a/examples/face_landmark/face_landmark.py +++ b/examples/face_landmark/face_landmark.py @@ -103,6 +103,7 @@ def draw_landmarks_on_image(rgb_image, detection_result): async def frame_loop(video_stream: rtc.VideoStream) -> None: + landmarker = FaceLandmarker.create_from_options(options) cv2.namedWindow("livekit_video", cv2.WINDOW_AUTOSIZE) cv2.startWindowThread() async for frame_event in video_stream: diff --git a/livekit-rtc/livekit/rtc/_ffi_client.py b/livekit-rtc/livekit/rtc/_ffi_client.py index f9788b2b..ad3cd6b8 100644 --- a/livekit-rtc/livekit/rtc/_ffi_client.py +++ b/livekit-rtc/livekit/rtc/_ffi_client.py @@ -136,14 +136,24 @@ def ffi_event_callback( which = event.WhichOneof("message") if which == "logs": for record in event.logs.records: - logger.log( - to_python_level(record.level), - "%s:%s:%s - %s", - record.target, - record.line, - record.module_path, - record.message, - ) + level = to_python_level(record.level) + rtc_debug = os.environ.get("LIVEKIT_WEBRTC_DEBUG", "").strip() + if ( + record.target == "libwebrtc" + and level == logging.DEBUG + and rtc_debug.lower() not in ("true", "1") + ): + continue + + if level is not None: + logger.log( + level, + "%s:%s:%s - %s", + record.target, + record.line, + record.module_path, + record.message, + ) return # no need to queue the logs elif which == "panic": @@ -155,7 +165,7 @@ def ffi_event_callback( FfiClient.instance.queue.put(event) -def to_python_level(level: proto_ffi.LogLevel.ValueType) -> int: +def to_python_level(level: proto_ffi.LogLevel.ValueType) -> Optional[int]: if level == proto_ffi.LogLevel.LOG_ERROR: return logging.ERROR elif level == proto_ffi.LogLevel.LOG_WARN: @@ -165,9 +175,12 @@ def to_python_level(level: proto_ffi.LogLevel.ValueType) -> int: elif level == proto_ffi.LogLevel.LOG_DEBUG: return logging.DEBUG elif level == proto_ffi.LogLevel.LOG_TRACE: - return logging.DEBUG + # Don't show TRACE logs inside DEBUG, it is too verbos + # Python's logging doesn't have a TRACE level + # return logging.DEBUG + pass - raise Exception("unreachable") + return None class FfiClient: diff --git a/livekit-rtc/rust-sdks b/livekit-rtc/rust-sdks index 040d7df2..799e95da 160000 --- a/livekit-rtc/rust-sdks +++ b/livekit-rtc/rust-sdks @@ -1 +1 @@ -Subproject commit 040d7df24fc589bc2313e086eb9673f50ad12e3c +Subproject commit 799e95da8cc30456465ed145403d273018721c28