Fix binaural OBR crash when using oar_set_metadata_unit_to_process (#29) - #30
Fix binaural OBR crash when using oar_set_metadata_unit_to_process (#29)#30jingbo-marquis wants to merge 3 commits into
Conversation
When oar_set_metadata_unit_to_process was called with a sub-frame size smaller than config.samples_per_channel for binaural rendering, OBR crashed because its internal buffer_size_per_channel (fixed at creation time) did not match the sub-frame input buffer size, triggering an ABSL_CHECK_EQ assertion failure in ObrImpl::Process. Changes: - Fix binaural OBR to always render the full frame using config.samples_per_channel, bypassing sub-frame position updates since OBR fixes buffer_size_per_channel at creation time (audio_elements_renderer.c) - Add input validation in oar_set_metadata_unit_to_process to reject samples == 0 or samples > config.samples_per_channel (oar.c) - Update API documentation to clarify that the samples parameter has no effect on binaural rendering (oar.h) - Add test_metadata_unit_processing.c with 12 test cases covering binaural/stereo sub-frame rendering, invalid parameters, and crash isolation Fixes #29 Signed-off-by: Jingbo Hou <jingbo.hou@samsung.com>
c98b8a9 to
0bd9289
Compare
|
Thanks @jingbo-marquis , I ran a review based on my context, and it seems that this PR introduces serious regression to the binaural object support path. The proposed tests are attached as a patch file (with Let me know what you think about this. Thanks. Details below, roughly in order of severity. Blocking1. Binaural object positions no longer reach OBRThe new I'd suggest keeping the position-application core but calling it at frame granularity (one The test suite doesn't catch this because no binaural TC asserts a position effect — TC1/TC2/TC4/TC5/TC7 only assert non-silence, and a sine at default front-center is non-silent. TC12 (the only position-effect assertion) is stereo-only. A binaural analogue of TC12 — e.g. assert left/right energy asymmetry after a ±80° azimuth update — would have failed on this PR and would guard the fix going forward. 2. The #29 crash class is still reachable
3. Heap buffer overflow in
|
| Test | main (pre-PR) |
this PR |
|---|---|---|
| TC13 mirrored ±80° | PASS | FAIL — the two renders are bit-identical (diff rms = 0) |
| TC14 update between frames | PASS | FAIL — interaural balance never flips |
| TC15 undersized block | FAIL (block accepted) | CRASHED — SIGABRT in ObrImpl::Process |
| TC16 mismatched blocks | FAIL (both accepted) | FAIL (both accepted) |
| TC4/TC7 (this PR's #29 tests) | CRASHED (the original bug) | PASS |
TC13/14 passing before this PR and failing after is the position regression from point 1 (and validates the tests' azimuth-sign expectations against the working path); TC15/16 failing on both sides shows the block-size validation gap from points 2–3 predates the PR and survives it. TC13's failure detail is worth quoting — the frozen front-center render still shows a ~2.6% interaural asymmetry from HRIR imperfection alone (E_L=126.6 vs E_R=123.3), which is why the primary assertion is "mirrored renders must differ" rather than an ILD threshold; ILD magnitude accuracy stays where it's already covered, in obr's own GetBroadbandILD unit tests.
Happy to open these as a follow-up PR instead if that's easier to pull from.
0001-Add-TC13-TC16-binaural-position-and-block-size-contr.patch.txt
- Replace sub-frame position rendering with frame-granularity position application since OBR does not support sub-frame rendering - Add input block validation (samples_per_channel and channels) to prevent OBR buffer size mismatch crash and heap overflow - Add TC13-TC17 binaural test cases covering mirrored positions, cross-frame updates, block size validation, and multi-element rendering - Register test_metadata_unit_processing in CTest, and Bazel Signed-off-by: Jingbo Hou <jingbo.hou@samsung.com>
Signed-off-by: Jingbo Hou <jingbo.hou@samsung.com>
|
@trsonic Changes
New tests (TC13–TC17, all passing)
|
When oar_set_metadata_unit_to_process was called with a sub-frame size smaller than config.samples_per_channel for binaural rendering, OBR crashed because its internal buffer_size_per_channel (fixed at creation time) did not match the sub-frame input buffer size, triggering an ABSL_CHECK_EQ assertion failure in ObrImpl::Process.
Changes:
Fixes #29