-
Notifications
You must be signed in to change notification settings - Fork 113
optimize unnecessary copy #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 In Root Cause and ImpactThe method sends a request via Compare with the correct check in if resp.apm_process_stream.error:
raise RuntimeError(resp.apm_process_stream.error)The if resp.apm_process_reverse_stream.error: # NOT apm_process_stream
raise RuntimeError(resp.apm_process_reverse_stream.error)Impact: Errors during reverse stream processing (used for echo cancellation) are silently swallowed, making it very difficult to diagnose audio processing failures in full-duplex setups. (Refers to lines 93-94) Was this helpful? React with 👍 or 👎 to provide feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡
_buffer_supported_or_raiseincorrectly rejects valid non-sliced memoryviews backed by non-byte-sized element typesThe sliced-memoryview check at line 53 compares
data.nbytes(always in bytes) withlen(data.obj)(element count for non-byte buffer types). This causes valid, non-sliced memoryviews backed by objects likearray.array, ctypes arrays, or numpy arrays to be incorrectly rejected.Root Cause and Impact
For
bytesandbytearray,len()returns byte count, so the check works. But for other buffer-exporting objects,len()returns element count:array.array('h', range(10)):len()= 10, butmemoryview(...).nbytes= 20numpy.zeros(10, dtype=np.int16):len()= 10, butmemoryview(...).nbytes= 20(c_int16 * 10)():len()= 10, butmemoryview(...).nbytes= 20When a user passes
memoryview(array.array('h', samples))ormemoryview(numpy_int16_array)as thedataargument toAudioFrame()orVideoFrame(),_buffer_supported_or_raiseraisesValueError("sliced memoryviews are not supported")even though the memoryview is perfectly valid and non-sliced.Impact: Users passing memoryviews of non-byte-element buffer objects (common with numpy or array.array workflows) will get a spurious
ValueError.Was this helpful? React with 👍 or 👎 to provide feedback.