Skip to content

Commit

Permalink
Add media support for G722 and iLBC codecs
Browse files Browse the repository at this point in the history
  • Loading branch information
hafkensite authored and wdoekes committed Feb 26, 2019
1 parent ff10ae3 commit f3b6fe8
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/beep_1sec_50x160b.g722
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ޛ7�$� � ��f�2�S��K�M����j�i�o�]����А��z���k�o�y��S�R����u����n�w�\��T�ٛ���n�n�t�����Q�����t�n�n�7����S�S�Z�z��p���w���S�В[���x򰮳�uw�^�R�Փ������m�v�{����ؐ��޷����m���T���������nu.wۿU�Y�[��������/�q�XW���]������qr7����\QV�����t���q��>W��}���~������0��zU����������q�z����W�=��r�o�j���~��S�ږy���k��r��tT��R|�X�o�������[�]�S�V��������p�1��Y�~XW�����������YzSۚ��4�v�����r�y�3Ζ_�?�^���w���z�<����z�p���������_��TTY�w���ps���|s�~����S�3�u���ݸ�v�_TY�ؑ��t������0�w���S\�]~�3����o�m�]�_��W���t�r���s�u��_Y�{���n�����������T�~������t�_�v�}R�^^޾����v���u�Խ�US�s����r����[�{���q�t���n��p�|��^��8Up����p��u���]��~���z�ﻱ�|����uPQ�_�s�t������|�~���ӛ\�����6�t����U\�ߺ3��r�p�t���}��W�w�5�m����u����ZX�ݙ����r�����>O{���ښ��ޮ���2�0������X�{�������q��uZ��Z�3����������y�W~�4�{�t��q�u����[�9�]\�/� �r���~��s\����{T��t�����������]�������{������}�����}����������}������|������{�������������{��޹���{߽�����z�������y�������w}������~�w��������������z������^������z��ݟ���|�����v�����_�������t������]������{�����������t������t�������w�����xr�����ux��t���y���s����t�y���׸���t������v߷���y�z�{���{����x��w�y������x������{����v������v�ۻ�ܻ�w������������������|���ߵt������w�����w���������u�����y�������x��s���{�{������w�y���v�v�|��v���t������u���v���t�����������w������x�������������u�������x�޻�߻v߸�����x߾�r����z�����z���z��{���t�����x������\�t������|�������w�x����|����������t�y���t����{��{�������y��t���{��ڸ�u���w���rߙ�t���[��w�޸�w�����{�ߵ���x��������������������_�����x�y����~�z�~��p�.�oӠ �`��n�Q�M�T�\}�v�n�-�u}\���ԕT��t����sw<���Ք�V[�|����.�x���VUԓ�Y���o�q��|����X�Y����or�q�x�XUT��U��t�m���|z�X�W��������o�s�y�[X���՗���r�n���}]��R�ܘ��s����r���[���ؗ��v�p�m�4x�W��ӗ]�{�����n�1��ؓ��T[�����,���}���U�W�Z������o�s�����^�֝���~�j�k��u~��ҙؓ��޴q�n��p�\����[�������1�3�ں�TY]�p����n��zTu�P�v�s������o�x�r�\������mu������Y~��]�s���Z������{�WxV�y�������v�s����V���n�o�����v�W���x����|�p���{��T�����r������^����\R]���|����t�x]��\S���x������q��_�_�T�u�z����r��w�u�T������*������X�����9�0�������w��~�Y]�����������y�Z��S�>�t��������z���Y�]�:ӱ����s�s�r����V��]��l������{�xWZ֖z�����m�8��}��V�|�ٻ�nw�����w��XS~Y�����tl���t}����^������t�r�o��|TT����{���tn����~�_����/�l���w��9YR�]�1�����Xt�}��_��}���������8��\����r��p�������]�z�S�~��w����r�t]W����ܝp�����w��4�X��1ε6�`��w�rZW_p��[��t^�������������z����|�������|�޻���~޼��~��z��_�������}������}������|�����~����޺�|�������z�������|�����|��������������x�����������s����u��������~����v�����������߳����v������x�ߝ����v�z�����{������z�������y���[���\��w���x������u�x�����u���{�����X���۳�{�x������{x������{�����_t���v������[x�w�������������~�x����w�y�����|�~���{��u������y�y������������������״�x�����߶y��u����x�u�~������v�����y�~����v���s������y��Z������v���ߘ�s��w������7������:���|��x���v���������{�{����s�����{��{����y�s������vv���z���\��v��������p�������x����ڴp�����������x������xx��t�t�y�������s������s�{��ܙ�|�������5��r������w��x���wv������w�����x�������v�t������_����z�_���t~{������y�{����y����t�x�{������{������{�ּ���v��������������ܸ����v�������w������v����z�z��w�y����x���w���|����w�������\�������y�����u����v���s���y����{��x��w���W�������޴�s���ݛz���z�����~���|�������z�����v�z�ߵ��_w�����z�v�������y������q�y�����u������z��y����������������w����w���y�{��ٹ�u�������\��ִ�7������Xz���v�|�{�y�������y������Zv������w������u���{����v�{�y�x������X�������ߴt������t�ض�w����X���x������xs������z�w�����������v�����z��������z���x�x��������y�u�������|�\��y���z������{��y���ݚ������ݵ����x�����x�|�x�������|�������x������y������]ܳ����������u���ޜt�y����z�6���������t�t����z�������u�����Z|�������;ھ��������x�~�����{���ߵ�;�w�y���W��v۹�{�y����������s������t��{��x����u����z��y���|��q������v�����v�u������u�����u���u����[�����|�w������x���y���x�w������w�x����t��{�ص��x�����ڵ�6ߜ�\ܲqu�y���y������x����y��w����������x��z���ٸ�z��������z�x����|�\w��~����~�����w�x������|����y����w�w�x��|��������|����[��u���|��{���u�y�x����x����������~��r���u������u�ܵ��x�|����w�{����\��\����|���ܷ�x��u����y�y�ܺ�~��]����|�u����x���y��ۻ�u��{������x�����״p���s�����u�������u�Y�������x���ڶ�{�t��������z�������v�y����y�������y���u��t������{�������s�y������\������Xy�����]~������w������{�w����۴q��z������\����w��u���z�x�u��������t���Z��������y�s���^���t�w�|������[�����y���������ٶ��������������x������|ں�x������Y��s����x��v���[���w�������u���y���u������u������u��~��z�t����z�x��v������\�����t������������w����t�������|�����{�{����w�������|����\��������������������x���������~���������x�x���t�|�~������9������{��x���t��x�����r�������u���ڹ�u�v�����v�������x�����x�x��v���v�~�����y�x���~����w���������x�����x��y����q������x�{�����^�������z�|������������~�߸���]{�����[�������x��{������X�����~�x������y����w����|�������7���ݵ�w�W��u������w�������v�|���~Y�����wyx�x���t����|������������ڶ�����_����w�~������]�����������x�{��]���z�w�y����]�������^ޘ�y��s�^��v���u�����{���������^������z���z��s������:������t���u������x��x���{����t���u���������[�����y���߸����x����w�u�w������u�y���w���u�����|��v���~���v��ֹ���v�X����w��y���Z�u���{��ܻ��u������x����������������x�w�����ܼ�_����y������x�v���~����������x�~���]��r�����5������������������������y�{�w�~t������y������w�y�����x�ڞ���x�������z�������v�������v�|�������V�������{����s����s��x۟����7���������tw������s\����x�X���w��[���s��x����\����r���y���]��ܾ��w�������<��x���w��sݼ�~z��s���������y������������u�y����y�z�����]��ݛ����\��x������9�r�����|�|���������۸��r�߸��v����x����{��{���y��q������[��������۶���s��v���r��Z����t�w�z�����t��x�����v��������w�w�����u������y���t���_��y����w����x��t���u����w������w�{�����{u������x�����x��������������Z���|���y����s��[y��������y����w���w����~���z��u����w���z�����z���ص�x�r�z�|���\����u�����|�߷�u������u�|�t�x���u������u��w�����|���׸�w�������u�����w�����_������X�����v������u������u�������|���������x�����5��v���s���u��z�w�w����u�����X������{v�����^���ܞ�r���z�������v�v���y���x������y����ܘ�t��������w�����]���{���x���{������x�y������;������\|�������x�v��x�u��s�����Z������{�w�����Z{������w�u�����yy�����Yx�x���{�������w�^����]�w�������q�������r��v������^s�����x���x�����x���]����{���{���ٲ�\���|�������v�ݚ�������������x���������w���z�v�����_����y�|���w�]x�y�y�_z�{���yw��x���t����v�ߺ���w��������������y�w�����X������|�x����y�����������z�����������ݲ����tٵ������x�����y�]������������{����]���x�����_�s���y���u���y�{�y�����z����ߟwu������w�u������x���y��u�|�������y��ۙ�r��~��y���x������z����t�ܴ�u�x�x������s������x������Wv�����^�x�������������w���������xܸ�\������t���{�u�����u����~w������t�|����y�t������u���z�v������������x�������V������\���{�����{�u����~��������������~y�������w�w������w��߾�x�y�ܺ�xx������x�{���x�z|��z����[������y��������y������u����_�{����|�߳���^^�����|��������ڻ��x�w����w�����{�u����w���y���|��|����w�������u������7�y�ܼ�w���t����{�x����t�������uټ�U���~��w���o��wם�v���w���������������y���~���X��������{��������w�����^��x���x���y���w�����8�y���X|�x���|y������y������y�w���|�������v��������w�����8������w������������x����x��y���z�y������sp������u�ܹ�w�ܴ�{��x���{�������u�������x��u׸����||����������|����u�z������z���y�����u������{��y�����xy������u�����t�s�{��������������������������6�v�w�x\�����_���\��xy�������x��y���u������v�v�����|���t�w�y����{������6�w�߳�x�w�����r������t������y������{�������x�w�����|����������������������������u�x��������������w���w�����w�x�����x���۹�v�{�x���_�������ut������y�ܶ�4�x����_w������\���_��x�~������\������|���v���_��u���ݾ�^��z������_r�����{����������y�������������������ڷ������߶��_����۶�:�������]���t���{�����t����|�x������9�]�v����ߗyq�x���~���\�������w�|����u�z������[w��y��v�t�w������������t�����u��u���x����r���y�����~����]�����x�����|�|����s��w���]��y�����sy������u�z��������������������������x���x���Y��v���\x�����]�����x��u�{���y���y���y��x�z��Y�����r����������x�������s���y��y�����s������w������\���v��~����w��\�����]������y�������u�u���z������v���s�|����t������y�v������8������uu�w����u�v�������Z�����������������Y�������
Binary file added docs/beep_1sec_50x160b.ilbc30
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/media.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ sender (used for sound and video echo).
RTP streaming
`````````````

SIPp can play a PCMA, PCMU or G729-encoded audio file over RTP.
SIPp can play a PCMA, PCMU, G722, iLBC or G729-encoded audio file over
RTP.

More details on how to do this can be found in the action reference
section.
Expand Down
24 changes: 20 additions & 4 deletions docs/scenarios/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ Example that execute a system echo for every INVITE received::
Media/RTP commands
++++++++++++++++++

RTP streaming allows you to stream audio from a PCMA, PCMU or
G729-encoded audio file (e.g. a .wav file). The "rtp_stream" action
controls this.
RTP streaming allows you to stream audio from a PCMA, PCMU, G722,
iLBC or G729-encoded audio file (e.g. a .wav file). The "rtp_stream"
action controls this.


+ <exec rtp_stream="file.wav" /> will stream the audio contained in
Expand All @@ -209,7 +209,8 @@ controls this.
stream the audio contained in [filename], repeat the stream
[loopcount] times (the default is 1, and -1 indicates it will repeat
forever), and will treat the audio as being of [payloadtype] (where 8
is the default of PCMA, 0 indicates PCMU, and 18 indicates G729).
is the default of PCMA, 0 indicates PCMU, 9 indicates G722, 18
indicates G729 and 98 indicates iLBC in 30ms 13.33kbps).
+ <exec rtp_stream="pause" /> will pause any currently active
playback.
+ <exec rtp_stream="resume" /> will resume any currently paused
Expand All @@ -231,7 +232,22 @@ play_pcap_audio="[file_to_play]" with:

+ file_to_play: the pre-recorded pcap file to play

The audio file should be the raw samples, example files are included
for PCMA, G722 and iLBC (mode=30).

===== ========== =========== =========== ================================
Codec Payload id Packet size Packet time FFMpeg arguments
===== ========== =========== =========== ================================
PCMU 0 160 bytes 20 ms -f ulaw -ar 8k -ac 1
PCMA 8 160 bytes 20 ms -f alaw -ar 8k -ac 1
G722 9 160 bytes 20 ms -f g722 -ar 16k -ac 1
G729 18 20 bytes 20 ms *not supported by ffmpeg*
iLBC 98 50 bytes 30 ms -f ilbc -ar 8k -ac 1 -b:a 13.33k
===== ========== =========== =========== ================================

.. note::
FFmpeg adds a header to iLBC files denoting the mode that is used, either 20
or 30 ms per packet. This header needs to be stripped from the file.
.. note::
The action is non-blocking. SIPp will start a light-weight thread to
play the file and the scenario with continue immediately. If needed,
Expand Down
10 changes: 10 additions & 0 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,21 @@ void CAction::setRTPStreamActInfo(const char* P_value)
M_rtpstream_actinfo.bytes_per_packet = 160;
M_rtpstream_actinfo.ticks_per_packet = 160;
break;
case 9:
M_rtpstream_actinfo.ms_per_packet = 20;
M_rtpstream_actinfo.bytes_per_packet = 160;
M_rtpstream_actinfo.ticks_per_packet = 160;
break;
case 18:
M_rtpstream_actinfo.ms_per_packet = 20;
M_rtpstream_actinfo.bytes_per_packet = 20;
M_rtpstream_actinfo.ticks_per_packet = 160;
break;
case 98:
M_rtpstream_actinfo.ms_per_packet = 30;
M_rtpstream_actinfo.bytes_per_packet = 50;
M_rtpstream_actinfo.ticks_per_packet = 240;
break;
default:
M_rtpstream_actinfo.ms_per_packet= -1;
M_rtpstream_actinfo.bytes_per_packet= -1;
Expand Down

0 comments on commit f3b6fe8

Please sign in to comment.