| 1 |
|
| 2 |
HOW TO ACTIVATE LIBSAMPLERATE |
| 3 |
(a.k.a SRC/Secret Rabbit Code) |
| 4 |
AS PJMEDIA'S SAMPLE RATE CONVERSION BACKEND |
| 5 |
|
| 6 |
by |
| 7 |
Benny Prijono |
| 8 |
PJSIP |
| 9 |
|
| 10 |
Background |
| 11 |
---------- |
| 12 |
Secret Rabbit Code (aka libsamplerate) is a sample rate conversion |
| 13 |
library, available from http://www.mega-nerd.com/SRC/index.html. |
| 14 |
It is licensed under the 2-clause BSD license (initially it was |
| 15 |
licensed under dual license, GPL and proprietary). |
| 16 |
|
| 17 |
|
| 18 |
Supported Platforms |
| 19 |
------------------- |
| 20 |
libsamplerate is available for Win32 with Visual Studio and the |
| 21 |
Makefile based targets (such as Linux, MacOS X, *nix, etc.). |
| 22 |
|
| 23 |
It's not supported for WinCE/Windows Mobile and Symbian since it is |
| 24 |
a floating point based implementation. |
| 25 |
|
| 26 |
|
| 27 |
Installation |
| 28 |
------------ |
| 29 |
- Download libsamplerate from http://www.mega-nerd.com/SRC/index.html |
| 30 |
|
| 31 |
- Untar libsamplerate-0.1.2.tar.gz into third_party directory |
| 32 |
cd third_party |
| 33 |
tar xzf libsamplerate-0.1.2.tar.gz |
| 34 |
|
| 35 |
- Rename libsamplerate-0.1.2 directory name to libsamplerate |
| 36 |
On Windows: |
| 37 |
ren libsamplerate-0.1.2 libsamplerate |
| 38 |
|
| 39 |
On Linux/Unix/MacOS X: |
| 40 |
mv libsamplerate-0.1.2 libsamplerate |
| 41 |
|
| 42 |
|
| 43 |
Visual Studio Build |
| 44 |
------------------- |
| 45 |
For Visual Studio projects, only static linkage is supported |
| 46 |
by PJMEDIA build system. If dynamic linking is desired, edit |
| 47 |
pjmedia/src/pjmedia/resample_libresample.c to prevent it from |
| 48 |
linking with the static library, and configure your project |
| 49 |
to link with libsamplerate DLL library. |
| 50 |
|
| 51 |
To build libresample static library with Visual Studio: |
| 52 |
|
| 53 |
- Open third_party/build/samplerate/libsamplerate_static.dsp |
| 54 |
- Build the project for both Debug and Release build |
| 55 |
|
| 56 |
|
| 57 |
libresample dynamic library can be produced by following the |
| 58 |
instructions in libresample source directory. |
| 59 |
|
| 60 |
|
| 61 |
Makefile build |
| 62 |
-------------- |
| 63 |
- Build and install libsamplerate (configure && make && make install). |
| 64 |
Please follow the instructions in libsamplerate documentation. |
| 65 |
|
| 66 |
- Re-run PJSIP's "configure" script with this option: |
| 67 |
|
| 68 |
./configure --enable-libsamplerate |
| 69 |
|
| 70 |
this will detect the presence of libsamplerate library and add it |
| 71 |
to the input library list. |
| 72 |
|
| 73 |
|
| 74 |
Enabling libsamplerate for PJMEDIA's resample |
| 75 |
--------------------------------------------- |
| 76 |
For both Visual Studio and Makefile based build system, add this in |
| 77 |
config_site.h: |
| 78 |
|
| 79 |
#define PJMEDIA_RESAMPLE_IMP PJMEDIA_RESAMPLE_LIBSAMPLERATE |
| 80 |
|
| 81 |
|
| 82 |
Limitations |
| 83 |
----------- |
| 84 |
Sample rate 22050 Hz is only supported with 20ms ptime, and sample rate 11025 Hz is only supported with 40ms ptime. This is the limitation of PJMEDIA rather than libsamplerate. |
| 85 |
|
| 86 |
|