You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VideoFrame and AudioFrame built from a read-only NumPy buffer fail in capture_frame with TypeError #884
rtc.VideoFrame and rtc.AudioFrame accept a memoryview. If the memoryview is read-only and covers the whole buffer, and the underlying object is not bytes or bytearray (for example a NumPy array from np.frombuffer), the constructor accepts it. Capturing the frame then fails in get_address:
TypeError: expected bytes, bytearray, or memoryview, got <class 'numpy.ndarray'>
The frame is captured, as it is when you pass pixels.tobytes() or a writable array.
Cause
_ensure_compatible_buffer only copies memoryviews whose nbytes differs from len(data.obj). For a read-only memoryview, get_address then reads the address from data.obj, which only works for bytes and bytearray.
Hi, I'm Himanshu, looking for a scoped contribution. I saw #885. Would a buffer matrix covering read-only and writable NumPy views, slices, and both AudioFrame and VideoFrame be useful? I'd check accepted inputs and capture behavior, with the existing tests as the starting point.
I haven't run this reproduction or the candidate PR's tests yet; this is an offer to investigate, not a claim that the gap is confirmed.
Activity
himanshumehta commentedon Oct 25, 2026
Hi, I'm Himanshu, looking for a scoped contribution. I saw #885. Would a buffer matrix covering read-only and writable NumPy views, slices, and both AudioFrame and VideoFrame be useful? I'd check accepted inputs and capture behavior, with the existing tests as the starting point.
I haven't run this reproduction or the candidate PR's tests yet; this is an offer to investigate, not a claim that the gap is confirmed.