From 7cb23dabe812e4f286cc3259ade276f130df3d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 14 Feb 2026 17:55:06 -0800 Subject: [PATCH 1/3] Update video_source.py --- livekit-rtc/livekit/rtc/video_source.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/livekit-rtc/livekit/rtc/video_source.py b/livekit-rtc/livekit/rtc/video_source.py index 5ae58f66..dd6989cb 100644 --- a/livekit-rtc/livekit/rtc/video_source.py +++ b/livekit-rtc/livekit/rtc/video_source.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations + from ._ffi_client import FfiHandle, FfiClient from ._proto import ffi_pb2 as proto_ffi from ._proto import video_frame_pb2 as proto_video @@ -19,11 +21,12 @@ class VideoSource: - def __init__(self, width: int, height: int) -> None: + def __init__(self, width: int, height: int, is_screencast: bool = False) -> None: req = proto_ffi.FfiRequest() req.new_video_source.type = proto_video.VideoSourceType.VIDEO_SOURCE_NATIVE req.new_video_source.resolution.width = width req.new_video_source.resolution.height = height + req.new_video_source.is_screencast = is_screencast resp = FfiClient.instance.request(req) self._info = resp.new_video_source.source From a610279fdbe6de09a862bd2ea83225148717cab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 14 Feb 2026 17:55:44 -0800 Subject: [PATCH 2/3] kwarg --- livekit-rtc/livekit/rtc/video_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/livekit-rtc/livekit/rtc/video_source.py b/livekit-rtc/livekit/rtc/video_source.py index dd6989cb..29c906ca 100644 --- a/livekit-rtc/livekit/rtc/video_source.py +++ b/livekit-rtc/livekit/rtc/video_source.py @@ -21,7 +21,7 @@ class VideoSource: - def __init__(self, width: int, height: int, is_screencast: bool = False) -> None: + def __init__(self, width: int, height: int, *, is_screencast: bool = False) -> None: req = proto_ffi.FfiRequest() req.new_video_source.type = proto_video.VideoSourceType.VIDEO_SOURCE_NATIVE req.new_video_source.resolution.width = width From cb7a82078d4c7d5b524501f5b502f886d6769fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 14 Feb 2026 18:01:46 -0800 Subject: [PATCH 3/3] docstrings --- livekit-rtc/livekit/rtc/video_source.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/livekit-rtc/livekit/rtc/video_source.py b/livekit-rtc/livekit/rtc/video_source.py index 29c906ca..be3b3635 100644 --- a/livekit-rtc/livekit/rtc/video_source.py +++ b/livekit-rtc/livekit/rtc/video_source.py @@ -22,6 +22,26 @@ class VideoSource: def __init__(self, width: int, height: int, *, is_screencast: bool = False) -> None: + """ + Create a new video source. + + Args: + width (int): Initial width of the video source. + height (int): Initial height of the video source. + is_screencast (bool, optional): Optimize the WebRTC pipeline for screen content. + Defaults to False. + + When True, WebRTC will: + + - Maintain resolution under congestion by dropping frames instead of + downscaling (keeps text crisp) + - Disable quality scaling and denoising to preserve text/UI readability + - Guarantee a minimum 1200 kbps bitrate floor + - Enable zero-hertz mode, stopping frame transmission when the screen + is static to save bandwidth + - Set content type to screen, adjusting encoder configuration throughout + the pipeline (VP9 inter-layer prediction, simulcast layer allocation, etc.) + """ req = proto_ffi.FfiRequest() req.new_video_source.type = proto_video.VideoSourceType.VIDEO_SOURCE_NATIVE req.new_video_source.resolution.width = width