Commit Graph

97 Commits

Author SHA1 Message Date
Pau Espin e786055567 osmux: Slightly improve output format of osmux_snprintf
The buffer for osmux_test is increased as the former doesn't seem to be
able to cope with the whole output.

Change-Id: Ic838dd9d7ad89b4510ccfa58c0390c69a075b616
2017-08-14 17:24:11 +02:00
Pau Espin 6032a35be8 tests: osmo-pcap: Allow different l2 pkts
Before this patch, ETH was assumed and other types were not supported.
This patch also adds Linux cooked packet support for L2.

Change-Id: Ie62fa0a8e45e1e141edb64b116dad185ad9c7a5f
2017-08-08 20:39:16 +02:00
Pau Espin 76c0acb149 tests: osmo-pcap: Fix per packet timer
Before this commit, the gap time between 2 packets {n-1, n} was being
applied to {n, n+1}.

Change-Id: I715865c1edd1fc2ec9b024671d91eb72559cbdea
2017-08-08 20:39:16 +02:00
Pau Espin 3460ad7f31 osmux: Use osmo_gettimeofday for testing puroposes
This way we can use fake time and osmux_test take 700ms instead of
>2sec to run.

Change-Id: Ic39cab74400aca8262a00c0d06884230b1a15ca3
2017-04-27 08:50:01 +00:00
Pau Espin e98afe5808 osmux: Add RTP marker bit support
According to RFC4867 (RTP payload format for AMR):
"The RTP header marker bit (M) SHALL be set to 1 if the first frameblock
carried in the packet contains a speech frame which is the first in a
talkspurt.  For all other packets the marker bit SHALL be set to zero (M=0)."

This information bit provides a way for the receiver to better
synchronize the delay with ther sender.

This is specially useful if AMR DTX features are supported and
enabled on the sender.

Change-Id: I0315658159429603f1d80a168718b026015060e9
2017-04-27 08:50:01 +00:00
Neels Hofmeyr d0b6eb4777 configure: check for pkg-config presence
Change-Id: Ifaea95befa3d1d8f6f047e22efcd62cb0bd8b287
2016-10-01 00:59:54 +02:00
Neels Hofmeyr f468e720ad osmux-test: remove real-time constraint by default
Introduce a local #define to disable the real-time constraint from osmux-test.
It would make sense to remove this completely, but in case anyone may be
interested in the timing on a specific platform, I've just #defined it away.

The real-time constraint to pass or fail the test is a bad idea in terms of our
build server. Whenever the server is loaded, the tests will fail for no reason,
like here: https://gerrit.osmocom.org/474
The real time to calculate is highly dependent also on the hardware platform.
The arbitrarity of the time constraint is sort of proven by dd24cdd95f
which simply doubles the time to pass the test.

Change-Id: Ic1da4bd22411652334f73195b2e37853e0738906
2016-07-07 14:13:16 +02:00
Neels Hofmeyr e03b3bc757 osmux_test.c: tweak error report 2016-02-29 15:49:10 +01:00
Pablo Neira Ayuso 552bae6081 tests: osmux: iterate 64 times in osmo_test_loop()
Instead of 63, this resolves major "definitely lost" remaining leak that
valgrind reports regarding msgb.
2015-07-21 12:04:58 +02:00
Pablo Neira Ayuso f71308001a tests: compile tests with debugging symbols, ie. -g
Useful when debuggin via valgrind/gdb.
2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso 41d5c3081a tests: osmux: fix msgb leaks 2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso f9407cc668 tests: osmux: test circuit reopening after closure
Make sure circuit routines works correctly.
2015-07-21 11:05:41 +02:00
Pablo Neira Ayuso b8bdc290d0 tests: osmux: validate dummy padding with no voice data interaction
Make sure that early dummy bandwitch preallocation works fine in the absence of
any kind of voice traffic.
2015-07-21 11:05:40 +02:00
Pablo Neira Ayuso 386e7755a7 tests: osmux: test online deactivation of dummy padding
Add RTP packets to circuit with dummy padding enabled to test automatic
deactivation once when start seeing real voice traffic.
2015-07-21 11:05:34 +02:00
Pablo Neira Ayuso b36951e6e3 tests: osmux: factor out main test loop
Move main test loop routine to the new osmux_test_loop() function.
2015-07-21 11:02:30 +02:00
Pablo Neira Ayuso 635bef7363 tests: osmux: adapt it to use the new circuit API
This also introduces a spare circuit that contains no voice data to test
bandwidth preallocation through the new osmux dummy frame type.
2015-07-21 10:24:23 +02:00
Jan Engelhardt 226e994832 build: remove all_includes
This variable is never set and could therefore be removed.
2014-10-02 23:22:55 +02:00
Jan Engelhardt de816861cb build: put dependency libraries in the right place in Makefiles
Libs must be in _LDADD/_LIBADD and not in _LDFLAGS.
2014-10-02 23:22:43 +02:00
Holger Hans Peter Freyther 153f585660 misc: Fix distcheck and refer to the right file 2014-05-22 17:25:57 +02:00
Pablo Neira Ayuso fe9823b6d5 tests: osmux: no need to skip RTP message anymore
With the fan-out approach to test multi-batch added int (078d532 tests:
osmux: test multi-batch support), this doesn't need the explicit
skip as there are already gaps to be filled.
2013-12-16 12:55:26 +01:00
Pablo Neira Ayuso 078d532930 tests: osmux: test multi-batch support
Extend this to test multi-batch in one packet support, eg.

OSMUX message (len=158) OSMUX seq=016 ccid=000 ft=1 ctr=6 amr_f=0 amr_q=1
amr_ft=02 amr_cmr=02 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff
fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54
ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff fb e7 eb f9 9f f8 f2
26 33 65 54 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff fb e7 eb
f9 9f f8 f2 26 33 65 54 ]OSMUX seq=017 ccid=001 ft=1 ctr=2 amr_f=0 amr_q=1
amr_ft=02 amr_cmr=02 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff
fb e7 eb f9 9f f8 f2 26 33 65 54 ff d4 f9 ff fb e7 eb f9 9f f8 f2 26 33 65 54 ]
2013-12-16 10:43:20 +01:00
Pablo Neira Ayuso dd24cdd95f tests: osmux-test: double timing validation threshold
Double timing validation to avoid hitting errors easily.
2013-05-27 11:19:35 +02:00
Pablo Neira Ayuso bd847cd71b tests: osmux_test: exercise osmux_replay_lost_packets
Emulate RTP message loss to test osmux_replay_lost_packets code
in src/osmux.c.

After this test, lcov reports 90.3% line coverage of osmux.c
2013-05-24 13:12:14 +02:00
Pablo Neira Ayuso 9d6d126c23 tests: osmux_test: deadline after 10 seconds
If the test takes longer than 10 seconds (it barely takes less than
a second according to `time'), bail out and report an error.
2013-05-24 11:22:41 +02:00
Holger Hans Peter Freyther b5be2f73e0 tests: Use the libosmonetif we just built for the tests
Use the library we just built instead for one already installed
in the system.
2013-05-24 07:58:10 +02:00
Pablo Neira Ayuso 479fba171b add testsuite infrastructure and osmux test
This patch adds the testsuite infrastructure and it populates it
with one test for osmux.

The osmux tests makes sure that:

* We get the same number of RTP messages in the input and the output path.
* The payload of the RTP message is reconstructed correctly.
* The reconstructed timing is correct.
2013-05-24 02:20:50 +02:00
Pablo Neira Ayuso 3f00a9b95f fix osmux_test with pcap file 2013-02-12 19:49:57 +01:00
Pablo Neira Ayuso 5654c43f80 osmux: remove generic functions to register and get ccid
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-20 20:17:28 +02:00
Pablo Neira Ayuso 384bdf630a osmux: release of batch message is controled by caller
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-15 18:14:59 +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 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 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 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 4aa55450a3 tests: osmo-pcap: cleanup for osmux test receiver loop 2012-08-02 17:39:02 +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 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 51d408acee tests: osmo-pcap: test osmux functions 2012-07-12 13:03:56 +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 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 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