Is it possible to configure PJSIP (PJSUA2) to use OPUS codec?
Asked
Active
Viewed 3,597 times
1 Answers
5
I finally found a way (ubuntu 14.04, require PJSIP >= 2.5):
Install opus@1.1.2 from source using following commands:
$ curl -sO http://downloads.xiph.org/releases/opus/opus-1.1.2.tar.gz $ tar xzvf opus-1.1.2.tar.gz \ && rm opus-1.1.2.tar.gz \ && cd opus-1.1.2 \ && ./configure \ && make && make check $ sudo make install \ && sudo ldconfig $ ldconfig -p | grep opus > libopus.so (libc6,x86-64) => /usr/local/lib/libopus.so
Install PJSIP@2.5 according to http://trac.pjsip.org/repos/ticket/1904:
curl -sO http://www.pjsip.org/release/2.5/pjproject-2.5.tar.bz2 tar xjf pjproject-2.5.tar.bz2 \ && rm pjproject-2.5.tar.bz2 \ && cd pjproject-2.5/ \ && ./configure --prefix=/usr --enable-shared --with-opus=/usr/local/ \ && make dep && make $ sudo make install && sudo ldconfig
Make sure OPUS is available
std::cout << "Available codecs:\n"; for (auto c : Endpoint::instance()->codecEnum()) { std::cout << " - " << c->codecId << " (priority: " << static_cast<int>(c->priority) << ")\n"; }
Available codecs:
- speex/16000/1 (priority: 130)
- speex/8000/1 (priority: 129)
- speex/32000/1 (priority: 128)
- iLBC/8000/1 (priority: 128)
- GSM/8000/1 (priority: 128)
- PCMU/8000/1 (priority: 128)
- PCMA/8000/1 (priority: 128)
- G722/16000/1 (priority: 128)
- opus/48000/2 (priority: 128)
- L16/44100/1 (priority: 0)
- L16/44100/2 (priority: 0)
- L16/8000/1 (priority: 0)
- L16/8000/2 (priority: 0)
- L16/16000/1 (priority: 0)
- L16/16000/2 (priority: 0)
- Adjust priority using
Endpoint::instance()->codecSetPriority("opus/48000", 131);

nicolaspanel
- 943
- 11
- 21
-
Hi, I got following error when - skipping incompatible /usr/local//lib/libopus.so. Any clue ? Building pjsip using --use-ndk-cflags. Does it means that I have to build opus using different compilers ? – user12384512 Jun 03 '16 at 14:15
-
If you're using NDK to build `pjsua2.so` then you also have to build opus with NDK. – csguth Feb 21 '19 at 19:38