[Asterisk-code-review] func_scramble: Audio scrambler function (asterisk[master])
Kevin Harwell
asteriskteam at digium.com
Tue Aug 10 16:47:29 CDT 2021
Attention is currently required from: N A, Richard Mudgett.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16231 )
Change subject: func_scramble: Audio scrambler function
......................................................................
Patch Set 6: Code-Review-1
(2 comments)
File funcs/func_scramble.c:
https://gerrit.asterisk.org/c/asterisk/+/16231/comment/904a2c7b_de09eab6
PS6, Line 195: ast_channel_lock(chan);
: if (!(datastore = ast_channel_datastore_find(chan, &scramble_datastore, NULL))) {
: ast_channel_unlock(chan);
: /* Allocate a new datastore to hold the reference to this audiohook information */
: if (!(datastore = ast_datastore_alloc(&scramble_datastore, NULL))) {
: return 0;
: }
: if (!(ni = ast_calloc(1, sizeof(*ni)))) {
: ast_datastore_free(datastore);
: return 0;
: }
: ast_audiohook_init(&ni->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Voice scrambler", AST_AUDIOHOOK_MANIPULATE_ALL_RATES);
: ni->audiohook.manipulate_callback = scramble_callback;
: datastore->data = ni;
: ast_channel_lock(chan);
: ast_channel_datastore_add(chan, datastore);
: ast_audiohook_attach(chan, &ni->audiohook);
: } else {
: ni = datastore->data;
: }
: ast_channel_unlock(chan);
Leave the lock/unlock calls surrounding the "if" but remove the ones embedded within. As it is now there is still a chance for two datastores on the same channel to be created.
https://gerrit.asterisk.org/c/asterisk/+/16231/comment/394fdd08_1fe1bcdf
PS6, Line 216: ni->tx = tx;
: ni->rx = rx;
Surround setting these variables too in the lock above otherwise two separate threads could attempt to modify them at the same time.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16231
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I01020769d91060a1f56a708eb405f87648d1a67e
Gerrit-Change-Number: 16231
Gerrit-PatchSet: 6
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Attention: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Tue, 10 Aug 2021 21:47:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210810/df2e2196/attachment.html>
More information about the asterisk-code-review
mailing list