aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmux.c
AgeCommit message (Collapse)AuthorFilesLines
2013-09-12osmux: add artificial limit for cloned RTP packetsPablo Neira Ayuso1-0/+4
Avoid spamming lots of cloned RTP packets in case of severe gaps.
2013-08-27osmux: sanity check too big RTP/RTCP messages as inputPablo Neira Ayuso1-0/+6
Holger spotted that the caller may loop forever in case it receives big RTP/RCTP packets, that are likely to be spoofed.
2013-05-27osmux: disable timing debuggingPablo Neira Ayuso1-1/+1
Disable timing debugging by default.
2013-05-24osmux: nul-terminate all strings generated by _snprintfPablo Neira Ayuso1-0/+3
Make sure all strings are null-terminated. Spotted by Holger Hans Peter Freyther.
2013-05-24osmux: further sanity checkings for AMR FTPablo Neira Ayuso1-5/+25
According to RFC3267, AMR FT upper 9 should be discarded. This patch adds extra validation to make sure that input RTP traffic encapsulating AMR payload and OSMUX amr_ft field are OK with regards to that restriction.
2013-05-24osmux: add sanity checking in osmux_xfrm_output_pullPablo Neira Ayuso1-2/+11
Osmux infers the size of the AMR payload from the FT type. Make sure we get enough data from the network according to what we expect.
2013-05-23osmux: remove trailing line break from osmux_snprintfPablo Neira Ayuso1-1/+1
2013-05-22osmux: fix warning spotted by clang --analyzePablo Neira Ayuso1-1/+1
osmux.c:622:20: warning: Value stored to 'osmuxh' during its initialization is never read struct osmux_hdr *osmuxh = (struct osmux_hdr *)msg->data; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported by Holger Hans Peter Freyther.
2013-05-21osmux: replay last RTP packet seen under packet loss scenarioPablo Neira Ayuso1-0/+51
If osmux notices a gap between two RTP packets, fill it with the last RTP packet seen. Without this patch, 10% of packet loss is enough to get garbage, with it we get glitches in the conversation with 30%, and pretty much broken conversation with 40% of it.
2013-05-20osmux: use ccid to identify batches instead of the RTP SSRCPablo Neira Ayuso1-8/+5
This should reduce the amount of batch nodes that are created by the maximum number of allowed circuit IDs.
2013-05-12osmux: add sanity checking to osmux_snprintfPablo Neira Ayuso1-5/+18
Add sanity checking to avoid crashes on malformed OSMUX packets
2013-05-12osmux: allow to set initial RTP SSRCPablo Neira Ayuso1-3/+3
Instead of using the osmuxh->circuit_id.
2013-02-19osmux: add osmux_snprintfPablo Neira Ayuso1-0/+92
Useful for debugging purposes. Modify also examples to use it.
2013-02-19osmux: RTP payload type for voice is dynamicPablo Neira Ayuso1-5/+6
Don't make any assumption on the payload type.
2013-02-19osmux: add talloc contextPablo Neira Ayuso1-3/+5
Good for debugging leaks.
2013-02-19osmux: initialize batch appropriately in osmux_xfrm_input_initPablo Neira Ayuso1-1/+1
Use talloc_size not talloc. Should fix: 0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230 0xb779401a in rb_erase (node=0x200200, root=0xb779c908) at rbtree.c:230 0xb778ee48 in osmo_timer_del (timer=0x94aacd0) at timer.c:110 0xb778ef65 in osmo_timer_add (timer=0x94aacd0) at timer.c:72 0xb778f03c in osmo_timer_schedule (timer=0x94aacd0, seconds=0, microseconds=64000) 0xb77360ff in osmux_xfrm_input (h=0x94a4280, msg=0x94b8a50, ccid=18) at osmux.c:390 Due to uninitialization batch structures.
2013-02-12osmux: use ft instead of the cmrPablo Neira Ayuso1-4/+4
The cmr is the requested codec for the other peer, the ft actually contains the current codec mode. cmr may contain 15 which means "don't care".
2013-02-12osmux: remove arrays from osmux_out_handlePablo Neira Ayuso1-10/+6
there will be one osmux_out_handle per endpoint.
2013-02-11osmux: allow to pass data to osmux_deliverPablo Neira Ayuso1-6/+6
2012-10-21osmux: fix missing data set in osmux_tx_schedPablo Neira Ayuso1-1/+1
2012-10-20osmux: remove generic functions to register and get ccidPablo Neira Ayuso1-53/+12
Remove these functions: - osmux_xfrm_input_get_ccid - osmux_xfrm_input_register_ccid The ccid will be managed by the BSC and it will be stored in the mgcp_endpoint structure. Also adjust all tests and examples using the API.
2012-10-15osmux: fix DELTA_RTP_MSGPablo Neira Ayuso1-2/+3
It should be 16000 and add DELTA_RTP_TIMESTAMP which is 160.
2012-10-15osmux: rewrite batching functionPablo Neira Ayuso1-67/+97
Rework batching routine to reduce its complexity, updates: * Now it uses a list of lists to store the messages that will be batched. batch list | `-> node SSRC=a ---> ... ---> node SSRC=b | | msg seq=x1 msg seq=y1 | | msg seq=x2 msg seq=y2 | | msg seq=x3 msg seq=y3 | | msg seq=x4 msg seq y4 This keeps easier the creation of the final batch that is sent from that data structure. * We also detect duplicate messages in the batch, ie. messages with the same sequence are skipped. Still pending to resolve reordering, corruption and omissions (reliability is desired).
2012-10-15osmux: RTP timestamp has to be bumped in 160Pablo Neira Ayuso1-1/+1
Between two RTP messages that were extracted from a batch, the timestamp difference should be 160. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15osmux: release of batch message is controled by callerPablo Neira Ayuso1-1/+0
Instead of internally released. This is required if we use the osmo_dgram infrastructure, to avoid a double release. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-10-15osmux: use DLMIB instead of internal defined DOSMUXPablo Neira Ayuso1-20/+17
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-08-06osmux: fix ordering of RTP messages in the batching listPablo Neira Ayuso1-12/+15
This patch fixes the ordering in RTP sequence number. Before this patch, the list was inverted. This also fixes the calculation of the room that still remains in the batch.
2012-08-06osmux: add OSMUX_MAX_CONCURRENT_CALLS which is 8Pablo Neira Ayuso1-4/+4
Instead of harcoding the number all around the code.
2012-08-06osmux: support two concurrent calls in output pathPablo Neira Ayuso1-5/+15
2012-08-06osmux: add infrastructure to map RTP SSRC and osmux CCIDPablo Neira Ayuso1-4/+48
2012-08-06osmux: fix wrong calculation of csrc_countPablo Neira Ayuso1-2/+1
2012-08-06osmux: batching factor can be explicitly configured by callerPablo Neira Ayuso1-4/+1
Not hardcoded in osmux.c code anymore.
2012-08-06osmux: store internal batching information in struct osmux_in_handlePablo Neira Ayuso1-29/+45
The layout is not provided, as it is internal. Thus, we don't allocate the internal batching information in BSS anymore.
2012-08-06osmux: print RTP header if debug logging level is setPablo Neira Ayuso1-4/+8
2012-08-04osmux: extend debugging to make sure we don't lag in scheduled transmissionsPablo Neira Ayuso1-2/+6
osmux only lags ~0.15 ms at maximum to transmit one scheduled RTP message according to my tests with PCAP traces. Yes, only ~0.15 milliseconds, this is not wrong :-). This is good news, our timer infrastructure seems to be quite precise.
2012-08-04osmux: remove timeval parameter from osmux_tx_schedPablo Neira Ayuso1-4/+7
We can internal allocate this in the stack, no need to expose it to the caller.
2012-08-04osmux: fix when to add the osmux headerPablo Neira Ayuso1-5/+9
This needs to be done for the first message in one RTP SSRC series. Before this patch, it was always included due to wrong aritmethics.
2012-08-04osmux: fix list ordering for RTP messages that will be included in batchPablo Neira Ayuso1-25/+12
This fixes the algorithms to include the messages in order in the batch based on the TRP SSRC (from lower to higher). This is very important to reduce the amount of bytes that we spend on the osmux header.
2012-08-04osmux: check for the maximum amount of messages in batchPablo Neira Ayuso1-1/+8
This should not happen, but make sure our osmux CTR field does not wrap around.
2012-08-04osmux: cleanup tx pathPablo Neira Ayuso1-22/+47
This patch cleans up the transmission path for osmux, this involves the functions that extract the messages from the batch and the one that reconstruct the timing. They now take a list that contains the reconstructed RTP messages: osmux_xfrm_output(osmuxh, &h_output, &list); osmux_tx_sched(&list, &tv, tx_cb, NULL);
2012-08-02osmux: major rework to reduce batch message size (add counter field)Pablo Neira Ayuso1-61/+198
This patch adds the counter field to the osmux header, so we can reduce the size of the batch even further, eg. osmuxhdr (ctr=3) speech speech speech osmuxhdr (ctr=2) speech speech ... The new header is the following: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FT | CTR |F|Q| SeqNR | Circuit ID |AMR-FT |AMR-CMR| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The counter field is 3 bits long, thus, we can batch up to 8 RTP speech frames into one single batch per circuit ID. I have also removed the RTP marker, since it can be reconstructed from the AMR information. Moreover, the entire workflow has been also reworked. Whenever a packet arrives, we introduce it into the batch list. This batch list contains a list of RTP messages ordered by RTP SSRC. Then, once the batch timer expires or the it gets full, we build the batch from the list of RTP messages. Note that this allows us to put several speech frame into one single osmux header without actually worrying about the amount of messages that we'll receive. The functions that reconstruct the RTP messages has been also adjusted. Now, it returns a list of RTP messages per RTP SSRC that has been extracted from the batch.
2012-08-02osmux: fix wrong maximum batch sizePablo Neira Ayuso1-1/+2
Missing UDP header in calculation.
2012-07-19osmux: use logging infrastructurePablo Neira Ayuso1-5/+11
so far, printf was used instead.
2012-07-19osmux: add DEBUG_TIMING to make sure timing reconstruction is OKPablo Neira Ayuso1-0/+15
by now, it is set on by default.
2012-07-19osmux: always use osmux_tx_cb in osmux_tx_schedPablo Neira Ayuso1-7/+5
This is required by the follow-up patch to debug timing issues.
2012-07-19osmux: add osmux_tx_sched to reconstruct the timing of RTP messagesPablo Neira Ayuso1-0/+42
This function schedules the transmission of a RTP message that was obtained from one osmux batch. It takes the time (in microseconds) after which the message should be transmitted.
2012-07-13osmux: use osmo_amr_bytes instead of hardcoded 15 bytes for CMR 2Pablo Neira Ayuso1-7/+9
I was using AMR CMR 2 (15 bytes) as the initial tests were done with the codec variant. This patch fixes this by using the new generic osmo_amr_bytes extracted from 3GPP TS 26.101.
2012-07-12add osmux supportPablo Neira Ayuso1-0/+218