livekit 1.2.1__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {livekit-1.2.1 → livekit-1.3.0}/PKG-INFO +1 -1
- livekit-1.3.0/livekit/rtc/version.py +1 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/video_frame.py +11 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit.egg-info/PKG-INFO +1 -1
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_dc.py +4 -1
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_ffi_handle_lifecycle.py +48 -30
- livekit-1.2.1/livekit/rtc/version.py +0 -1
- {livekit-1.2.1 → livekit-1.3.0}/README.md +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/__init__.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_ffi_client.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/__init__.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/audio_frame_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/audio_frame_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/capture_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/capture_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/data_stream_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/data_stream_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/data_track_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/data_track_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/e2ee_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/e2ee_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/ffi_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/ffi_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/handle_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/handle_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/participant_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/participant_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/room_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/room_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/rpc_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/rpc_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/stats_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/stats_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/track_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/track_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/track_publication_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/track_publication_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/video_frame_pb2.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_proto/video_frame_pb2.pyi +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/_utils.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/apm.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_filter.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_frame.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_mixer.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_resampler.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_source.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/audio_stream.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/data_stream.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/data_track.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/e2ee.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/encoded_video.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/event_emitter.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/frame_processor.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/jupyter.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/log.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/media_devices.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/participant.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/platform_audio.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/py.typed +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/resources/__init__.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/resources/jupyter-html/index.html +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/room.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/rpc.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/synchronizer.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/track.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/track_publication.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/transcription.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/utils.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/video_source.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit/rtc/video_stream.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit.egg-info/SOURCES.txt +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit.egg-info/dependency_links.txt +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit.egg-info/requires.txt +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/livekit.egg-info/top_level.txt +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/pyproject.toml +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/setup.cfg +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/setup.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_audio.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_audio_stream_init.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_audio_stream_room_lifecycle.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_basic.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_broadcast_queue.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_change_video_quality.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_data_stream_writer.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_e2ee.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_e2ee_per_participant.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_e2ee_shared_key.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_ffi_client.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_rpc_interceptors.py +0 -0
- {livekit-1.2.1 → livekit-1.3.0}/tests/test_video.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.0"
|
|
@@ -47,9 +47,20 @@ class VideoFrame:
|
|
|
47
47
|
type (proto_video.VideoBufferType.ValueType): The format type of the video frame data
|
|
48
48
|
(e.g., RGBA, BGRA, RGB24, etc.).
|
|
49
49
|
data (Union[bytes, bytearray, memoryview]): The raw pixel data for the video frame.
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
ValueError: If `data` is smaller than a frame of this size and type.
|
|
50
53
|
"""
|
|
51
54
|
data = _ensure_compatible_buffer(data)
|
|
52
55
|
|
|
56
|
+
min_size = _get_plane_length(type, width, height)
|
|
57
|
+
data_size = data.nbytes if isinstance(data, memoryview) else len(data)
|
|
58
|
+
if data_size < min_size:
|
|
59
|
+
raise ValueError(
|
|
60
|
+
f"data length must be >= {min_size} bytes for a {width}x{height} "
|
|
61
|
+
f"{proto_video.VideoBufferType.Name(type)} frame, got {data_size}"
|
|
62
|
+
)
|
|
63
|
+
|
|
53
64
|
self._width = width
|
|
54
65
|
self._height = height
|
|
55
66
|
self._type = type
|
|
@@ -308,10 +308,13 @@ async def test_publish_data_makes_no_ctypes_array_type() -> None:
|
|
|
308
308
|
lambda: len(collector.packets) >= len(payloads),
|
|
309
309
|
message="receiver did not get all payloads",
|
|
310
310
|
)
|
|
311
|
+
# Check `type(o)` instead of `isinstance(o, type)`: gc can hand back a
|
|
312
|
+
# dead `weakref.proxy`, and isinstance() dereferences it and raises
|
|
313
|
+
# ReferenceError (seen on Windows ARM64).
|
|
311
314
|
array_types = [
|
|
312
315
|
o
|
|
313
316
|
for o in gc.get_objects()
|
|
314
|
-
if
|
|
317
|
+
if issubclass(type(o), type)
|
|
315
318
|
and issubclass(o, ctypes.Array)
|
|
316
319
|
and getattr(o, "_length_", None) in lengths
|
|
317
320
|
]
|
|
@@ -14,26 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
-
import gc
|
|
18
17
|
import subprocess
|
|
19
18
|
import sys
|
|
20
19
|
|
|
21
20
|
import pytest
|
|
22
21
|
|
|
23
22
|
from livekit.rtc._ffi_client import FfiClient, FfiHandle
|
|
24
|
-
from livekit.rtc._proto import audio_frame_pb2, ffi_pb2
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _allocate_real_handle() -> int:
|
|
28
|
-
req = ffi_pb2.FfiRequest()
|
|
29
|
-
req.new_audio_source.type = audio_frame_pb2.AUDIO_SOURCE_NATIVE
|
|
30
|
-
req.new_audio_source.sample_rate = 48000
|
|
31
|
-
req.new_audio_source.num_channels = 1
|
|
32
|
-
req.new_audio_source.queue_size_ms = 100
|
|
33
|
-
resp = FfiClient.instance.request(req)
|
|
34
|
-
handle_id = resp.new_audio_source.source.handle.id
|
|
35
|
-
assert handle_id != 0
|
|
36
|
-
return int(handle_id)
|
|
37
23
|
|
|
38
24
|
|
|
39
25
|
def test_active_runtime_invalid_handle_asserts() -> None:
|
|
@@ -42,26 +28,57 @@ def test_active_runtime_invalid_handle_asserts() -> None:
|
|
|
42
28
|
FfiHandle(999999).dispose()
|
|
43
29
|
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
# Runs in a fresh interpreter: FfiClient._dispose() tears down the process-wide
|
|
32
|
+
# FFI runtime, and every later test in the same pytest process would then wait
|
|
33
|
+
# forever for FFI callbacks that never arrive.
|
|
34
|
+
_DISPOSE_MARKS_LIVE_HANDLES_CONSUMED = """
|
|
35
|
+
import gc
|
|
36
|
+
|
|
37
|
+
from livekit.rtc._ffi_client import FfiClient, FfiHandle
|
|
38
|
+
from livekit.rtc._proto import audio_frame_pb2, ffi_pb2
|
|
39
|
+
|
|
40
|
+
req = ffi_pb2.FfiRequest()
|
|
41
|
+
req.new_audio_source.type = audio_frame_pb2.AUDIO_SOURCE_NATIVE
|
|
42
|
+
req.new_audio_source.sample_rate = 48000
|
|
43
|
+
req.new_audio_source.num_channels = 1
|
|
44
|
+
req.new_audio_source.queue_size_ms = 100
|
|
45
|
+
resp = FfiClient.instance.request(req)
|
|
46
|
+
handle_id = resp.new_audio_source.source.handle.id
|
|
47
|
+
assert handle_id != 0
|
|
48
|
+
|
|
49
|
+
handle = FfiHandle(handle_id)
|
|
50
|
+
assert not handle.disposed
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
# Global dispose marks all live handles consumed and sets _ffi_disposed
|
|
53
|
+
FfiClient.instance._dispose()
|
|
54
|
+
assert handle.disposed
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
# Explicit dispose or __del__ after global dispose should be a no-op and not assert
|
|
57
|
+
handle.dispose()
|
|
58
|
+
handle.__del__()
|
|
59
|
+
|
|
60
|
+
# Newly instantiated handle after global dispose also safely no-ops without assert
|
|
61
|
+
late_handle = FfiHandle(12345)
|
|
62
|
+
late_handle.dispose()
|
|
63
|
+
|
|
64
|
+
del handle
|
|
65
|
+
del late_handle
|
|
66
|
+
gc.collect()
|
|
67
|
+
print("ok")
|
|
68
|
+
"""
|
|
57
69
|
|
|
58
|
-
# Newly instantiated handle after global dispose also safely no-ops without assert
|
|
59
|
-
late_handle = FfiHandle(12345)
|
|
60
|
-
late_handle.dispose()
|
|
61
70
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
def test_live_handles_marked_consumed_and_no_assert_after_dispose() -> None:
|
|
72
|
+
result = subprocess.run(
|
|
73
|
+
[sys.executable, "-c", _DISPOSE_MARKS_LIVE_HANDLES_CONSUMED],
|
|
74
|
+
capture_output=True,
|
|
75
|
+
text=True,
|
|
76
|
+
timeout=60,
|
|
77
|
+
)
|
|
78
|
+
assert result.returncode == 0, result.stderr
|
|
79
|
+
assert result.stdout.strip() == "ok"
|
|
80
|
+
assert "AssertionError" not in result.stderr
|
|
81
|
+
assert "Exception ignored" not in result.stderr
|
|
65
82
|
|
|
66
83
|
|
|
67
84
|
def test_subprocess_exit_with_undisposed_handle_has_no_assertion_error() -> None:
|
|
@@ -85,6 +102,7 @@ sys.exit(0)
|
|
|
85
102
|
[sys.executable, "-c", code],
|
|
86
103
|
capture_output=True,
|
|
87
104
|
text=True,
|
|
105
|
+
timeout=60,
|
|
88
106
|
)
|
|
89
107
|
assert result.returncode == 0
|
|
90
108
|
assert "AssertionError" not in result.stderr
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.2.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|