Commit Graph

76 Commits

Author SHA1 Message Date
Pablo Neira Ayuso 7a01104b88 osmux: add OSMUX_MAX_CONCURRENT_CALLS which is 8
Instead of harcoding the number all around the code.
2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso 72a0aae500 osmux: support two concurrent calls in output path 2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso b9cf903bbe osmux: add infrastructure to map RTP SSRC and osmux CCID 2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso da0c9ab922 osmux: fix wrong calculation of csrc_count 2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso 468d81b4ac osmux: batching factor can be explicitly configured by caller
Not hardcoded in osmux.c code anymore.
2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso f366c924e2 osmux: store internal batching information in struct osmux_in_handle
The layout is not provided, as it is internal.

Thus, we don't allocate the internal batching information in BSS
anymore.
2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso 6d72b4a729 osmux: print RTP header if debug logging level is set 2012-08-06 21:04:25 +02:00
Pablo Neira Ayuso 33817320cb rtp: add osmo_rtp_snprintf
To print the RTP header and payload.
2012-08-06 21:04:21 +02:00
Pablo Neira Ayuso f4b11c0717 osmux: extend debugging to make sure we don't lag in scheduled transmissions
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-04 21:16:27 +02:00
Pablo Neira Ayuso d2ea108728 osmux: remove timeval parameter from osmux_tx_sched
We can internal allocate this in the stack, no need to expose it to
the caller.
2012-08-04 21:03:56 +02:00
Pablo Neira Ayuso 81979fa80a osmux: fix when to add the osmux header
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-04 20:56:53 +02:00
Pablo Neira Ayuso 082d700a8f osmux: fix list ordering for RTP messages that will be included in batch
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-04 20:53:57 +02:00
Pablo Neira Ayuso 2cefb116d0 osmux: check for the maximum amount of messages in batch
This should not happen, but make sure our osmux CTR field does not
wrap around.
2012-08-04 20:52:45 +02:00
Pablo Neira Ayuso fe9fccd412 osmux: cleanup tx path
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-04 19:59:33 +02:00
Pablo Neira Ayuso fdc6538986 fix wrong delta between two RTP messages
it should 20 ms, not 160 ms. Thanks for Holger for spotting this.
2012-08-04 18:39:45 +02:00
Pablo Neira Ayuso ffd20f3f1c osmux: major rework to reduce batch message size (add counter field)
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-02 20:36:19 +02:00
Pablo Neira Ayuso b03de23120 tests: osmux: initialize input handler before first run
Make sure we don't segfault due to uninitiliazed handler.
2012-08-02 20:35:31 +02:00
Pablo Neira Ayuso 5e8fab1419 tests: osmo-pcap: callback control the release of the emulated packet
The callback is now in charge of releasing the packet.
2012-08-02 20:34:04 +02:00
Pablo Neira Ayuso 969db946d4 osmux: osmux_get_payload returns uint8_t * instead void *
So we easily add offsets without any casting.
2012-08-02 20:25:36 +02:00
Pablo Neira Ayuso 52c7649e23 osmux: fix wrong maximum batch size
Missing UDP header in calculation.
2012-08-02 20:24:31 +02:00
Pablo Neira Ayuso 4aa55450a3 tests: osmo-pcap: cleanup for osmux test receiver loop 2012-08-02 17:39:02 +02:00
Pablo Neira Ayuso 8a8c47aaba osmux: use logging infrastructure
so far, printf was used instead.
2012-07-19 13:04:39 +02:00
Pablo Neira Ayuso 937ab515cb tests: osmo-pcap: use logging infrastructure
so far, it was missing and printf was used instead of the generic
logging infrastructure that osmocom provides.
2012-07-19 13:03:39 +02:00
Pablo Neira Ayuso 0db9b568f2 osmux: add DEBUG_TIMING to make sure timing reconstruction is OK
by now, it is set on by default.
2012-07-19 12:53:04 +02:00
Pablo Neira Ayuso 6071c652cf osmux: always use osmux_tx_cb in osmux_tx_sched
This is required by the follow-up patch to debug timing issues.
2012-07-19 12:49:55 +02:00
Pablo Neira Ayuso 004d5aad0e tests: osmo-pcap: split packet replay from osmux_test code
This patch splits in two files the code that contains the packet replay
based on PCAP from the osmux test.
2012-07-19 12:21:25 +02:00
Pablo Neira Ayuso 413513a704 tests: osmo-pcap: adapt it to use new osmux_tx_sched
Adapt the test to use the function that allows reconstructing the
RTP timing sequence.
2012-07-19 11:43:08 +02:00
Pablo Neira Ayuso 8ba490fd96 osmux: add osmux_tx_sched to reconstruct the timing of RTP messages
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-19 11:38:50 +02:00
Pablo Neira Ayuso d3c21b3cad osmux: use osmo_amr_bytes instead of hardcoded 15 bytes for CMR 2
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-13 21:17:51 +02:00
Pablo Neira Ayuso 42915068af src: add function to obtain bytes depending on AMR frame code 2012-07-13 21:12:32 +02:00
Pablo Neira Ayuso 51d408acee tests: osmo-pcap: test osmux functions 2012-07-12 13:03:56 +02:00
Pablo Neira Ayuso 00b6026f64 add osmux support 2012-07-12 13:03:07 +02:00
Pablo Neira Ayuso e53d2ed172 osmo-pcap-test: add -g compilation for debugging (valgrind) and use -losmonetif 2012-07-12 13:01:33 +02:00
Pablo Neira Ayuso efaae10304 rtp: add new parameter to osmo_rtp_get_payload to obtain payload length 2012-07-12 13:01:28 +02:00
Pablo Neira Ayuso c6dceb8cf7 amr: add osmo_amr_get_payload 2012-07-12 13:01:25 +02:00
Pablo Neira Ayuso 93b16cb871 rtp: add RTP_PT_RTCP (72-76 for RTCP)
As specified by RFC 3551, these are reserved to distinguish
RCTP from RTP.
2012-07-09 16:58:46 +02:00
Pablo Neira Ayuso 67b988a077 rtp: add missing RTP_PT_AMR for AMR-WB (type 98) and RTP_PT_GSM_HALF (96) 2012-07-09 16:58:12 +02:00
Pablo Neira Ayuso a359315c8b include: add AMR definitions in amr.h header
As defined by RFC3267 in Octed-Aligned mode.
2012-07-07 17:43:14 +02:00
Pablo Neira Ayuso e142ddfd77 rtp: split osmo_rtp_parse in two functions
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-07 17:40:17 +02:00
Pablo Neira Ayuso d2de668547 tests: osmo-pcap: fix bad UDP header calculation
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-04 10:21:50 +02:00
Pablo Neira Ayuso f52b3c8b11 rtp: remove unused rtp_handle parameter from osmo_rtp_parse
And also adjust example files to use the new function.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-03 20:03:01 +02:00
Pablo Neira Ayuso f04b5f66f3 rtp: move RTP header definitions to include rtp.h
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-07-03 18:44:32 +02:00
Pablo Neira Ayuso 435f7a7dfe add .gitignore
Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-06-28 18:57:53 +02:00
Pablo Neira Ayuso 75755dd7d9 test: add osmo-pcap-test infrastructure
This patch adds the osmo-pcap-test infrastructure that allows you
to take packets stored in one pcap file, convert them to msgb and
pass it to some function.

The infrastructure also provides timing reconstruction based on
the pcap file information.

This is useful for easy protocol development, automated testing and
fuzzying of the existing code to validate the code.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2012-06-28 16:42:22 +02:00
Pablo Neira Ayuso 729a0917ac add rs232 support
This include an example to open /dev/ttyACM0 to receive data from
u-blox GPS and one to configure it in TIMEPULSE2 mode.
2012-04-04 19:08:27 +02:00
Pablo Neira Ayuso 163707ba12 build: use libosmo-netif.pc instead libosmonetif.pc
Otherwise, openbsc fails to find this new library by libosmo-netif.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:51:01 +01:00
Pablo Neira Ayuso bc4208095d build: fix wrong name for linking options
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:56 +01:00
Pablo Neira Ayuso 4cd6689587 examples: Display more details on RTP payload in rtp-udp-test-*
Minor change, more verbose output to make sure the functions in
the library are doing OK.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:54 +01:00
Pablo Neira Ayuso 59b4f79946 datagram: minor cleanup
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2012-02-23 19:50:47 +01:00
Pablo Neira Ayuso 72cd95b352 add RTP support
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>
2012-02-23 13:44:26 +01:00