[asterisk-bugs] [JIRA] (ASTERISK-27669) [patch] codecs: Add support for WebRTC iLBC 2.0.

George Joseph (JIRA) noreply at issues.asterisk.org
Mon Feb 12 09:33:13 CST 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Joseph updated ASTERISK-27669:
-------------------------------------

    Status: Open  (was: Triage)

> [patch] codecs: Add support for WebRTC iLBC 2.0.
> ------------------------------------------------
>
>                 Key: ASTERISK-27669
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27669
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Codecs/codec_ilbc
>    Affects Versions: 13.19.0, 15.2.0
>            Reporter: Alexander Traud
>              Labels: patch, webrtc
>         Attachments: enable_WebRTC_iLBC_2.0.patch
>
>
> ASTERISK-19835 added support for WebRTC iLBC 1.1. However, the header file {{ilbc.h}} changed slightly for version 2.0. That version is available as a pre-packaged port on FreeBSD 11. Therefore, if that port is installed, Asterisk does not build.
> *History*
> Google bought iLBC and included it within their WebRTC efforts as additional audio-codec. WebRTC is designed to be built as static library. which is added to an app as one big library. The WebRTC project does not allow be built as individual shared libraries. In other words, while building WebRTC according its [documentation|https://webrtc.org/native-code/development/], a step like {{gn gen out/Default --args='is_component_build=true'}} fails.
> Therefore in February 2012, [Jeroen Dekkers|https://github.com/dekkers] extracted the iLBC library from the WebRTC project, created a build system around it, and added a compatibility layer. libilbc was born. That got version 1.1 which was supported with ASTERISK-19835. In December 2014, [Tiancheng Gu|https://github.com/TimothyGu] took [over|https://github.com/dekkers/libilbc/issues/13] and updated to the latest upstream code of the WebRTC team.
> That is just an underestimate. Both did a great job to keep the API similar to IETF iLBC 1.0 ([RFC 3951|https://tools.ietf.org/html/rfc3951]). The WebRTC team created a new API to hide the internals of iLBC. Because the code is not designed as shared library, the WebRTC team did not care about the old API and broke compatibility. Timothy and Jeroen restored that API as much as possible:
> # [initial change for shared library|https://github.com/dekkers/libilbc/commit/a98b38c1593317ab77684808caafea38ba27cca8]
> # [old API|https://github.com/dekkers/libilbc/commit/83b0a350e10d1c10903c30dd0680f139416dcb83]
> # [create structs for old API users|https://github.com/TimothyGu/libilbc/commit/1be98256eed50bc68b5388f4f1fdb544f58da5a1]
> # [detect POSIX Threads|https://github.com/TimothyGu/libilbc/commit/27998beba5563a5c3dd4b491086b48bf9cfe7021#diff-c243ae162c736233762a348240363009]
> # [update version|https://github.com/TimothyGu/libilbc/commit/13baaff8265e7df60801b912edc76be5026afb81#diff-a4da484cf5c91edc6bcb162fb2661d54]
> *Steps to Reproduce*
> The following was done on Ubuntu 16.04 LTS:{code}sudo apt install build-essential git
> git clone git://github.com/dekkers/libilbc
> cd ./libilbc
> autoreconf --install
> ./configure
> make
> sudo make install
> cd ../
> sudo apt install build-essential pkg-config
> sudo apt install libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxml2-dev
> wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
> tar -zxf asterisk-*-current.tar.gz
> cd ./asterisk-*
> ./configure
> make{code}
> *Expected Results*
> The output of the script {{./configure}} indicates that iLBC was found. Asterisk builds.
> *Actual Results*
> {code}   [CC] codec_ilbc.c -> codec_ilbc.o
> codec_ilbc.c:45:9: error: unknown type name 'WebRtc_UWord16'
>  typedef WebRtc_UWord16 ilbc_bytes;
>          ^~~~~~~~~~~~~~
> codec_ilbc.c:46:9: error: unknown type name 'WebRtc_Word16'
>  typedef WebRtc_Word16  ilbc_block;
>          ^~~~~~~~~~~~~
> codec_ilbc.c: In function 'ilbctolin_framein':
> codec_ilbc.c:139:15: warning: passing argument 1 of 'WebRtcIlbcfix_DecodeImpl' from incompatible pointer type [-Wincompatible-pointer-types]
>    iLBC_decode(tmpf, plc_mode ? f->data.ptr + x : NULL, &tmp->dec, plc_mode);
>                ^~~~
> In file included from codec_ilbc.c:44:0:
> /usr/local/include/ilbc.h:413:8: note: expected 'int16_t * {aka short int *}' but argument is of type 'ilbc_block * {aka int *}'
>    void WebRtcIlbcfix_DecodeImpl(int16_t *decblock,
>         ^~~~~~~~~~~~~~~~~~~~~~~~
> codec_ilbc.c: In function 'lintoilbc_frameout':
> codec_ilbc.c:184:15: warning: passing argument 1 of 'WebRtcIlbcfix_EncodeImpl' from incompatible pointer type [-Wincompatible-pointer-types]
>    iLBC_encode((ilbc_bytes *) pvt->outbuf.BUF_TYPE, tmpf, &tmp->enc);
>                ^
> In file included from codec_ilbc.c:44:0:
> /usr/local/include/ilbc.h:417:8: note: expected 'uint16_t * {aka short unsigned int *}' but argument is of type 'ilbc_bytes * {aka int *}'
>    void WebRtcIlbcfix_EncodeImpl(uint16_t *bytes,
>         ^~~~~~~~~~~~~~~~~~~~~~~~
> codec_ilbc.c:184:52: warning: passing argument 2 of 'WebRtcIlbcfix_EncodeImpl' from incompatible pointer type [-Wincompatible-pointer-types]
>    iLBC_encode((ilbc_bytes *) pvt->outbuf.BUF_TYPE, tmpf, &tmp->enc);
>                                                     ^~~~
> In file included from codec_ilbc.c:44:0:
> /usr/local/include/ilbc.h:417:8: note: expected 'const int16_t * {aka const short int *}' but argument is of type 'ilbc_block * {aka int *}'
>    void WebRtcIlbcfix_EncodeImpl(uint16_t *bytes,
>         ^~~~~~~~~~~~~~~~~~~~~~~~{code}
> *Workarounds*
> * (short term) Uninstall libilbc. Then, Asterisk builds its internal libilbc, a copy of IETF iLBC 1.0.
> * (mid term) The attached patch resolves the issue by using the original types for WebRtc\_\{U\}Word16 which is compatible both with WebRTC iLBC 1.1 and WebRTC iLBC 2.0.
> * (long term) The outdated iLBC library within Asterisk should be removed because that project is maintained upstream. With such a change, issues like this one here are found sooner.
> This issue was found while creating the prerequisites for FreeBSD and by going through the [change log|https://svnweb.freebsd.org/ports/head/net/asterisk13/?view=log] of the Asterisk port of FreeBSD itself. However, this issue affects all platforms.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list