livekit 1.2.1__tar.gz → 1.2.2__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.
Files changed (90) hide show
  1. {livekit-1.2.1 → livekit-1.2.2}/PKG-INFO +1 -1
  2. livekit-1.2.2/livekit/rtc/version.py +1 -0
  3. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/video_frame.py +11 -0
  4. {livekit-1.2.1 → livekit-1.2.2}/livekit.egg-info/PKG-INFO +1 -1
  5. {livekit-1.2.1 → livekit-1.2.2}/tests/test_dc.py +4 -1
  6. {livekit-1.2.1 → livekit-1.2.2}/tests/test_ffi_handle_lifecycle.py +48 -30
  7. livekit-1.2.1/livekit/rtc/version.py +0 -1
  8. {livekit-1.2.1 → livekit-1.2.2}/README.md +0 -0
  9. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/__init__.py +0 -0
  10. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_ffi_client.py +0 -0
  11. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/__init__.py +0 -0
  12. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/audio_frame_pb2.py +0 -0
  13. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/audio_frame_pb2.pyi +0 -0
  14. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/capture_pb2.py +0 -0
  15. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/capture_pb2.pyi +0 -0
  16. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/data_stream_pb2.py +0 -0
  17. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/data_stream_pb2.pyi +0 -0
  18. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/data_track_pb2.py +0 -0
  19. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/data_track_pb2.pyi +0 -0
  20. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/e2ee_pb2.py +0 -0
  21. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/e2ee_pb2.pyi +0 -0
  22. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/ffi_pb2.py +0 -0
  23. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/ffi_pb2.pyi +0 -0
  24. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/handle_pb2.py +0 -0
  25. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/handle_pb2.pyi +0 -0
  26. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/participant_pb2.py +0 -0
  27. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/participant_pb2.pyi +0 -0
  28. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/room_pb2.py +0 -0
  29. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/room_pb2.pyi +0 -0
  30. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/rpc_pb2.py +0 -0
  31. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/rpc_pb2.pyi +0 -0
  32. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/stats_pb2.py +0 -0
  33. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/stats_pb2.pyi +0 -0
  34. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/track_pb2.py +0 -0
  35. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/track_pb2.pyi +0 -0
  36. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/track_publication_pb2.py +0 -0
  37. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/track_publication_pb2.pyi +0 -0
  38. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/video_frame_pb2.py +0 -0
  39. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_proto/video_frame_pb2.pyi +0 -0
  40. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/_utils.py +0 -0
  41. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/apm.py +0 -0
  42. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_filter.py +0 -0
  43. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_frame.py +0 -0
  44. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_mixer.py +0 -0
  45. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_resampler.py +0 -0
  46. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_source.py +0 -0
  47. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/audio_stream.py +0 -0
  48. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/data_stream.py +0 -0
  49. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/data_track.py +0 -0
  50. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/e2ee.py +0 -0
  51. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/encoded_video.py +0 -0
  52. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/event_emitter.py +0 -0
  53. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/frame_processor.py +0 -0
  54. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/jupyter.py +0 -0
  55. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/log.py +0 -0
  56. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/media_devices.py +0 -0
  57. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/participant.py +0 -0
  58. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/platform_audio.py +0 -0
  59. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/py.typed +0 -0
  60. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/resources/__init__.py +0 -0
  61. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/resources/jupyter-html/index.html +0 -0
  62. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/room.py +0 -0
  63. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/rpc.py +0 -0
  64. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/synchronizer.py +0 -0
  65. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/track.py +0 -0
  66. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/track_publication.py +0 -0
  67. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/transcription.py +0 -0
  68. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/utils.py +0 -0
  69. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/video_source.py +0 -0
  70. {livekit-1.2.1 → livekit-1.2.2}/livekit/rtc/video_stream.py +0 -0
  71. {livekit-1.2.1 → livekit-1.2.2}/livekit.egg-info/SOURCES.txt +0 -0
  72. {livekit-1.2.1 → livekit-1.2.2}/livekit.egg-info/dependency_links.txt +0 -0
  73. {livekit-1.2.1 → livekit-1.2.2}/livekit.egg-info/requires.txt +0 -0
  74. {livekit-1.2.1 → livekit-1.2.2}/livekit.egg-info/top_level.txt +0 -0
  75. {livekit-1.2.1 → livekit-1.2.2}/pyproject.toml +0 -0
  76. {livekit-1.2.1 → livekit-1.2.2}/setup.cfg +0 -0
  77. {livekit-1.2.1 → livekit-1.2.2}/setup.py +0 -0
  78. {livekit-1.2.1 → livekit-1.2.2}/tests/test_audio.py +0 -0
  79. {livekit-1.2.1 → livekit-1.2.2}/tests/test_audio_stream_init.py +0 -0
  80. {livekit-1.2.1 → livekit-1.2.2}/tests/test_audio_stream_room_lifecycle.py +0 -0
  81. {livekit-1.2.1 → livekit-1.2.2}/tests/test_basic.py +0 -0
  82. {livekit-1.2.1 → livekit-1.2.2}/tests/test_broadcast_queue.py +0 -0
  83. {livekit-1.2.1 → livekit-1.2.2}/tests/test_change_video_quality.py +0 -0
  84. {livekit-1.2.1 → livekit-1.2.2}/tests/test_data_stream_writer.py +0 -0
  85. {livekit-1.2.1 → livekit-1.2.2}/tests/test_e2ee.py +0 -0
  86. {livekit-1.2.1 → livekit-1.2.2}/tests/test_e2ee_per_participant.py +0 -0
  87. {livekit-1.2.1 → livekit-1.2.2}/tests/test_e2ee_shared_key.py +0 -0
  88. {livekit-1.2.1 → livekit-1.2.2}/tests/test_ffi_client.py +0 -0
  89. {livekit-1.2.1 → livekit-1.2.2}/tests/test_rpc_interceptors.py +0 -0
  90. {livekit-1.2.1 → livekit-1.2.2}/tests/test_video.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Python Real-time SDK for LiveKit
5
5
  Author-email: LiveKit <support@livekit.io>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "1.2.2"
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Python Real-time SDK for LiveKit
5
5
  Author-email: LiveKit <support@livekit.io>
6
6
  License-Expression: Apache-2.0
@@ -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 isinstance(o, type)
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
- def test_live_handles_marked_consumed_and_no_assert_after_dispose() -> None:
46
- handle_id = _allocate_real_handle()
47
- handle = FfiHandle(handle_id)
48
- assert not handle.disposed
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
- # Global dispose marks all live handles consumed and sets _ffi_disposed
51
- FfiClient.instance._dispose()
52
- assert handle.disposed
52
+ # Global dispose marks all live handles consumed and sets _ffi_disposed
53
+ FfiClient.instance._dispose()
54
+ assert handle.disposed
53
55
 
54
- # Explicit dispose or __del__ after global dispose should be a no-op and not assert
55
- handle.dispose()
56
- handle.__del__()
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
- del handle
63
- del late_handle
64
- gc.collect()
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