[Asterisk-code-review] jitterbuffer: Correct signed/unsigned mismatch causing assert (asterisk[16])
George Joseph
asteriskteam at digium.com
Thu Jun 17 12:59:03 CDT 2021
Attention is currently required from: Sean Bright.
Hello Friendly Automation,
I'd like you to reexamine a change. Please visit
https://gerrit.asterisk.org/c/asterisk/+/16073
to look at the new patch set (#2).
Change subject: jitterbuffer: Correct signed/unsigned mismatch causing assert
......................................................................
jitterbuffer: Correct signed/unsigned mismatch causing assert
If the system time steps backwards because of a time adjustment
between the time a frame is timestamped and the time we check the
timestamps in abstract_jb:hook_event_cb(), we get a negative
interval, but we don't check for that there.
abstract_jb:hook_event_cb() then calls fixedjitterbuffer:fixed_jb_get
() (via abstract_jb:jb_get_fixed) and the first thing that does is
assert(interval >= 0).
There are several issues with this...
* abstract_jb:hook_event_cb() saves the interval in a variable
named "now" which is confusing in itself.
* "now" is defined as an unsigned int which converts the negative
value returned from ast_tvdiff_ms() to a large positive value.
* fixed_jb_get()'s parameter is defined as a signed int so the
interval gets converted back to a negative value.
* fixed_jb_get()'s assert is NOT an ast_assert but a direct define
that points to the system assert() so it triggers even in
production mode.
So...
* hook_event_cb()'s "now" was renamed to "relative_frame_start" and
changed to an int64_t.
* hook_event_cb() now checks for a negative value right after
retrieving both the current and framedata timestamps and just
returns the frame if the difference is negative.
* fixed_jb_get()'s local define of ASSERT() was changed to call
ast_assert() instead of the system assert().
ASTERISK-29480
Reported by: Dan Cropp
Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9
---
M main/abstract_jb.c
M main/fixedjitterbuf.c
2 files changed, 19 insertions(+), 9 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/16073/2
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16073
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ic469dec73c2edc3ba134cda6721a999a9714f3c9
Gerrit-Change-Number: 16073
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-CC: Sean Bright <sean at seanbright.com>
Gerrit-Attention: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210617/5d84d72d/attachment.html>
More information about the asterisk-code-review
mailing list