Skip to content

Commit 98988e5

Browse files
committed
Merge remote-tracking branch 'origin/main' into dz/simulate-scenario
2 parents f2ffba2 + 57f7274 commit 98988e5

46 files changed

Lines changed: 2099 additions & 1334 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# CODEOWNERS for python-sdks
2+
# These owners will be requested for review on all PRs
3+
4+
* @cloudwebrtc @lukasIO @xianshijing-lk

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,20 @@ LiveKit is a dynamic realtime environment and calls can fail for various reasons
274274

275275
You may throw errors of the type `RpcError` with a string `message` in an RPC method handler and they will be received on the caller's side with the message intact. Other errors will not be transmitted and will instead arrive to the caller as `1500` ("Application Error"). Other built-in errors are detailed in `RpcError`.
276276

277+
## Hardware video codec support
278+
279+
The underlying Rust SDK ships with platform-specific hardware-accelerated encoders/decoders, These are used automatically when available and compatible with the runtime environment (OS, drivers, GPU, and codec).
280+
281+
| Platform | Codec(s) | Encoder | Decoder | Backend |
282+
| ------------------------------ | ---------- | ------- | ------- | -------------------------------------- |
283+
| macOS | H264, H265 ||| VideoToolbox |
284+
| Linux (AMD GPU) | H264 || | VAAPI |
285+
| Linux x64 (NVIDIA GPU) | H264, H265 ||| NVENC / NVDEC (NVIDIA Video Codec SDK) |
286+
287+
Software encoders (libvpx for VP8/VP9, libaom for AV1, OpenH264 for H264) are used as a fallback when hardware acceleration is not available.
288+
289+
> **Note:** Availability depends on the specific machine configuration, including GPU model, driver support, and runtime environment.
290+
277291
## Examples
278292

279293
- [Facelandmark](https://github.com/livekit/python-sdks/tree/main/examples/face_landmark): Use mediapipe to detect face landmarks (eyes, nose ...)

examples/e2ee.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import asyncio
22
import logging
3+
import os
34
from signal import SIGINT, SIGTERM
45

56
import numpy as np
67
from livekit import rtc
78

8-
URL = "ws://localhost:7880"
9-
TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE5MDY2MTMyODgsImlzcyI6IkFQSVRzRWZpZFpqclFvWSIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NzI2MTMyODgsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb20iOiJ0ZXN0Iiwicm9vbUFkbWluIjp0cnVlLCJyb29tQ3JlYXRlIjp0cnVlLCJyb29tSm9pbiI6dHJ1ZSwicm9vbUxpc3QiOnRydWV9fQ.uSNIangMRu8jZD5mnRYoCHjcsQWCrJXgHCs0aNIgBFY" # noqa
9+
URL = os.environ.get("LIVEKIT_URL", "ws://localhost:7880")
10+
TOKEN = os.environ.get(
11+
"LIVEKIT_TOKEN",
12+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE5MDY2MTMyODgsImlzcyI6IkFQSVRzRWZpZFpqclFvWSIsIm5hbWUiOiJuYXRpdmUiLCJuYmYiOjE2NzI2MTMyODgsInN1YiI6Im5hdGl2ZSIsInZpZGVvIjp7InJvb20iOiJ0ZXN0Iiwicm9vbUFkbWluIjp0cnVlLCJyb29tQ3JlYXRlIjp0cnVlLCJyb29tSm9pbiI6dHJ1ZSwicm9vbUxpc3QiOnRydWV9fQ.uSNIangMRu8jZD5mnRYoCHjcsQWCrJXgHCs0aNIgBFY",
13+
) # noqa
1014

11-
# ("livekitrocks") this is our shared key, it must match the one used by your clients
12-
SHARED_KEY = b"livekitrocks"
15+
# This shared key must match the one used by your clients
16+
SHARED_KEY = os.environ.get("E2EE_SHARED_KEY", "livekitrocks").encode()
1317

1418
WIDTH, HEIGHT = 1280, 720
1519

@@ -106,7 +110,7 @@ def on_e2ee_state_changed(participant: rtc.Participant, state: rtc.EncryptionSta
106110
e2ee_options.key_provider_options.shared_key = SHARED_KEY
107111

108112
await room.connect(
109-
URL, TOKEN, options=rtc.RoomOptions(auto_subscribe=True, e2ee=e2ee_options)
113+
URL, TOKEN, options=rtc.RoomOptions(auto_subscribe=True, encryption=e2ee_options)
110114
)
111115

112116
logging.info("connected to room %s", room.name)

livekit-api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"aiohttp>=3.9.0",
3131
"protobuf>=4",
3232
"types-protobuf>=4",
33-
"livekit-protocol>=1.1.5,<2.0.0",
33+
"livekit-protocol>=1.1.8,<2.0.0",
3434
]
3535

3636
[project.urls]

livekit-protocol/generate_proto.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protoc \
3838
$API_PROTOCOL/livekit_analytics.proto \
3939
$API_PROTOCOL/livekit_rtc.proto \
4040
$API_PROTOCOL/agent/livekit_agent_session.proto \
41+
$API_PROTOCOL/agent/livekit_agent_inference.proto \
4142
$API_PROTOCOL/agent/livekit_agent_text.proto \
4243
$API_PROTOCOL/agent/livekit_agent_dev.proto \
4344
$API_PROTOCOL/logger/options.proto \
@@ -87,6 +88,8 @@ mv "$API_OUT_PYTHON/livekit_connector_pb2.py" "$API_OUT_PYTHON/connector.py"
8788
mv "$API_OUT_PYTHON/livekit_connector_pb2.pyi" "$API_OUT_PYTHON/connector.pyi"
8889

8990
mkdir -p "$API_OUT_PYTHON/agent_pb"
91+
mv "$API_OUT_PYTHON/agent/livekit_agent_inference_pb2.py" "$API_OUT_PYTHON/agent_pb/agent_inference.py"
92+
mv "$API_OUT_PYTHON/agent/livekit_agent_inference_pb2.pyi" "$API_OUT_PYTHON/agent_pb/agent_inference.pyi"
9093
mv "$API_OUT_PYTHON/agent/livekit_agent_session_pb2.py" "$API_OUT_PYTHON/agent_pb/agent_session.py"
9194
mv "$API_OUT_PYTHON/agent/livekit_agent_session_pb2.pyi" "$API_OUT_PYTHON/agent_pb/agent_session.pyi"
9295
mv "$API_OUT_PYTHON/agent/livekit_agent_text_pb2.py" "$API_OUT_PYTHON/agent_pb/agent_text.py"
@@ -98,7 +101,7 @@ mkdir -p "$API_OUT_PYTHON/logger_pb"
98101
mv "$API_OUT_PYTHON/logger/options_pb2.py" "$API_OUT_PYTHON/logger_pb/options.py"
99102
mv "$API_OUT_PYTHON/logger/options_pb2.pyi" "$API_OUT_PYTHON/logger_pb/options.pyi"
100103

101-
find "$API_OUT_PYTHON" -name '*.py' -o -name '*.pyi' | xargs perl -i -pe 's|^(import (livekit_egress_pb2\|livekit_room_pb2\|livekit_webhook_pb2\|livekit_ingress_pb2\|livekit_models_pb2\|livekit_agent_pb2\|livekit_agent_dispatch_pb2\|livekit_analytics_pb2\|livekit_sip_pb2\|livekit_metrics_pb2\|livekit_rtc_pb2\|livekit_connector_whatsapp_pb2\|livekit_connector_twilio_pb2\|livekit_connector_pb2\|livekit_agent_session_pb2\|livekit_agent_dev_pb2\|options_pb2))|from . $1|g'
104+
find "$API_OUT_PYTHON" -name '*.py' -o -name '*.pyi' | xargs perl -i -pe 's|^(import (livekit_egress_pb2\|livekit_room_pb2\|livekit_webhook_pb2\|livekit_ingress_pb2\|livekit_models_pb2\|livekit_agent_pb2\|livekit_agent_dispatch_pb2\|livekit_analytics_pb2\|livekit_sip_pb2\|livekit_metrics_pb2\|livekit_rtc_pb2\|livekit_connector_whatsapp_pb2\|livekit_connector_twilio_pb2\|livekit_connector_pb2\|livekit_agent_session_pb2\|livekit_agent_inference_pb2\|livekit_agent_dev_pb2\|livekit_agent_text_pb2\|options_pb2))|from . $1|g'
102105

103106
find "$API_OUT_PYTHON" -name '*.py' -o -name '*.pyi' | xargs perl -i -pe 's|livekit_(\w+)_pb2|${1}|g'
104107

@@ -112,4 +115,4 @@ find "$API_OUT_PYTHON" -mindepth 2 -name '*.py' -o -name '*.pyi' | xargs perl -i
112115
find "$API_OUT_PYTHON"/agent_pb -name '*.py' -o -name '*.pyi' | xargs perl -i -pe 's|from agent import (agent_\w+) as ([^ ]+)|from . import $1 as $2|g'
113116

114117
# fixes - error: ClassVar can only be used for assignments in class body [misc]
115-
perl -i -pe 's|^(\w+_FIELD_NUMBER): _ClassVar\[int\]|$1: int|g' "$API_OUT_PYTHON/logger_pb/options.pyi"
118+
perl -i -pe 's|^(\w+_FIELD_NUMBER): _ClassVar\[int\]|$1: int|g' "$API_OUT_PYTHON/logger_pb/options.pyi"

0 commit comments

Comments
 (0)