aboutsummaryrefslogtreecommitdiffstats
path: root/src/rtp.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-13Add SPDX-License-Identifier + Copyright statementsHarald Welte1-0/+19
Change-Id: I43bb1c4a889421907a1a08eb29c96f2330ab00ec
2017-09-12src: _snprintf() helper functions nul-terminate buffers, if possiblePablo Neira Ayuso1-0/+3
This patch inconditionally initializes the buffer we get to nul-terminate it, whenever possible. It's a very simple solution to catch three overly corner cases: 1) snprintf() returns -1, very much unlikely in practise. 2) msg->len == 0: In such case, I would expect this function is never called with an empty message, but let's be safe in this case too. 3) If your buffer is empty, it doesn't nul-terminate the buffer. Change-Id: I97e517f2d98e83894ea707c63489559302ff6bd2
2017-09-11osmux: fix buffer management mess in snprintf() callsPablo Neira Ayuso1-13/+14
SNPRINTF_BUFFER_SIZE() looks too complex, previous version maintains two different variables to account for the remaining space in the buffer, one of them is always decremented based on what snprintf() returns, which may result in underflow. These variables are swapped - not used consistently - all over this code. Replace this macro by a simplified version, with one single parameter to account for remaining space. This macro also deals with two corner cases: 1) snprintf() fails, actually never happens in practise, but documentation indicates it may return -1, so let's catch this case from here to stick to specs. 2) There is not enough space in the buffer, in that case, keep increasing offset, so we know how much would have been printed, just like snprintf() does. Thanks to Pau Espin for reporting, and Holger for clues on this. I have run osmux_test and, at quick glance, it looks good. Change-Id: I5b5d6ec57a02f57c23b1ae86dbd894bad28ea797
2017-09-05rtp: return offset in osmo_rtp_snprintf()Pablo Neira Ayuso1-1/+1
Instead of the result of the last snprintf() call. Change-Id: I10066d73387be96a4e1f3349d700405beb138076
2017-07-13rtp.c: Fix print formatPau Espin Pedrol1-3/+4
Fixes compilation warning Change-Id: I0146a19bf852c9e27d265a098dc9d7a337424e10
2015-03-22endian: Use the new endian macros for portabilityHolger Hans Peter Freyther1-1/+0
Use the new macros to deal with little/big endian. Im a bit worried to make this change due the little test coverage in this module but in case of a typo the elements would not be defined.
2013-05-22rtp: fix wrong time arithmetics in osmo_rtp_buildPablo Neira Ayuso1-2/+2
rtp.c:154:26: warning: The left operand to '/' is always 0 frame_diff = (usec_diff / 20000); ~~~~~~~~~ ^ rtp.c:157:43: warning: The left operand to '-' is always 0 long int frame_diff_excess = frame_diff - 1; ~~~~~~~~~~ ^ rtp.c:153:39: warning: The right operand to '+' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ^ ~~~~~~~~~~~~~~~ rtp.c:153:29: warning: The left operand to '*' is always 0 usec_diff = tv_diff.tv_sec * 1000000 + tv_diff.tv_usec; ~~~~~~~~~~~~~~ ^ 4 warnings generated. Reported by Holger Hans Peter Freyther.
2012-08-06rtp: add osmo_rtp_snprintfPablo Neira Ayuso1-0/+40
To print the RTP header and payload.
2012-07-12rtp: add new parameter to osmo_rtp_get_payload to obtain payload lengthPablo Neira Ayuso1-1/+3
2012-07-07rtp: split osmo_rtp_parse in two functionsPablo Neira Ayuso1-19/+21
This patch splits osmo_rtp_parse in two functions: osmo_rtp_get_hdr osmo_rtp_get_payload So we can validate corrent RTP header to access its fields. Then, obtain the payload.
2012-07-03rtp: remove unused rtp_handle parameter from osmo_rtp_parsePablo Neira Ayuso1-1/+1
And also adjust example files to use the new function. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-03rtp: move RTP header definitions to include rtp.hPablo Neira Ayuso1-49/+0
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-02-23add RTP supportPablo Neira Ayuso1-0/+231
This patch adds the initial RTP support for libosmo-netif, it's based on Harald's RTP support available in openBSC. I have also added a couple of example to show how our new channel infrastructure interacts with the RTP layer. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>