AgeCommit message (Collapse)AuthorFilesLines
2018-07-09Make RTP payload type configurableHEADmasterVadim Yanitskiy4-18/+64
For a long time the RTP payload type was hard-coded for outgoing frames. The problem is that according to RFC 3551 only GSM FR has a static payload type value (see table 4, value 3). For other codecs the payload type may be negotiated between the both sides dynamically (i.e. in range 96-127). Let's allow a binary/API user to configure this manually. Change-Id: Ia07ed4e13b4a70c8bb4181564a8190861fd269da Closes: OS#2482
2018-07-09build: fix packaging problems and make distcheck happyVadim Yanitskiy3-4/+10
The 'distcheck' rule performs all of the operations associated with packaging a distribution and verifying that the distribution works. There were several problems: - libgsmhr/ 'patches' dir was not listed in EXTRA_DIST - libgsmhr/ (dist)clean targets wan't defined properly - tests/ 'ref-files' dir was not listed in EXTRA_DIST - tests/ wrong path was used for io_sample.txt Change-Id: Ieb8f6a2a81f9b75c8c6c5db443b0e7be02bc4153 disable building libgsmhr by defaultVadim Yanitskiy1-3/+3
At the moment, Half Rate codec support is limited. There are still some issues with encoding of the reference files (see OS#2514), and moreover AddressSanitizer is not happy about libgsmhr... Change-Id: Ib86f3f972fc31c7eedf7ed75a7c356ac62e47dc6 Related: OS#2514
2018-07-03fmt_ti.c: fix: properly pre-clean the output bufferVadim Yanitskiy1-1/+2
Despite it was stated that only the last nibble isn't being written, some other bytes in the middle of the output buffer were uninitialized during the first exectution of a queue. The problem was observed with AddressSanitizer enabled. Valgrind output: $ valgrind --track-origins=yes \ src/.libs/lt-osmo-gapk \ -i tests/ref-files/hhgttg_part1_5.s16.ti-efr \ -f ti-efr -g rawpcm-s16le \ -o /dev/null -v Conditional jump or move depends on uninitialised value(s) at 0x52728F2: msb_put_bit (utils.h:39) by 0x52728F2: amr_efr_from_canon (fmt_amr.c:45) by 0x5270A7D: osmo_gapk_pq_execute (procqueue.c:202) by 0x40296A: run (app_osmo_gapk.c:650) by 0x40296A: main (app_osmo_gapk.c:778) Uninitialised value was created by a heap allocation at 0x4C2AB80: malloc (in by 0x4E3C2A8: talloc_named_const (in by 0x5270A1B: osmo_gapk_pq_prepare (procqueue.c:180) by 0x402940: run (app_osmo_gapk.c:645) by 0x402940: main (app_osmo_gapk.c:778) Change-Id: I79df56dde23702b0eac8e8fdbc0efd270cc0ace4 Related: OS#2934
2018-07-03tests: make both Valgrind and LeakSanitizer happyVadim Yanitskiy4-0/+12
The talloc_enable_null_tracking() actually allocates a new talloc context, which makes both Valgrind and LeakSanitizer angry. This context should be freed by the talloc_disable_null_tracking(). Change-Id: Ia660d2fdac720f685c0186720d0a476d7e9468be fix: conditionally enable 'ecu/ecu_fr_test'Vadim Yanitskiy1-0/+1
In the 'ecu/ecu_fr_test' we have a processing queue with Full Rate decoder block, which depends on libgsm. If libgsm isn't available, the test will fail. Let's enable this test conditionally. Change-Id: I74cf0e9de1e2f65e7227ee1565f12622bb55cabe
2018-07-03libgsmhr/ fix source code downloadingVadim Yanitskiy1-1/+6
For some reason, the 3GPP server started to reject the source code download request: urllib2.HTTPError: HTTP Error 403: Forbidden Adding both 'User-Agent' and 'Accept' headers solves the problem. Change-Id: I8afd39c85dd3e450c5355888ab6edcf4c81f8b87
2018-07-03contrib/ enable AddressSanitizerVadim Yanitskiy1-1/+1
Change-Id: I5075107e9b563c06f43eb4544e81aefae3ad1f7d
2018-06-29Implement ECU (Error Concealment Unit) block for FRVadim Yanitskiy10-0/+440
In I06a21f60db01bfe1c2b838f93866fad1d53fdcd1 the Error Concealment Unit API for FR codec was introduced. This change implements a corresponding block. Note: at the moment, only Full Rate is supported by the ECU API. Change-Id: Ia929ee04f6be3d842c6ef7bc40cce0fdab16e90a
2018-06-29procqueue.c: rely on item type instead of its positionVadim Yanitskiy1-15/+17
In the osmo_gapk_pq_prepare() we do allocate an item's buffer conditionally, only when its type is not sink, because an output buffer is not required for sink. Let's use a bit more elegant way to check, whether item is sink. Change-Id: I770a1d02273d9d8301a9e4ec72426fb8f4060277
2018-06-29app_osmo_gapk.c: use recommended osmo_init_logging2()Vadim Yanitskiy1-1/+1
The osmo_init_logging() was deprecated. Change-Id: Ic30a924571feb273274587998e87c86b688c3544
2018-02-19Ignore build productsMax1-0/+3
Change-Id: I24be6fdbd17c7877d7a9a87081107dc5a3cd2fe8
2018-02-14Merge "Add basic CI integration"Max1-0/+42
2018-02-14Merge "Add --enable-sanitize configure option"Harald Welte1-0/+9
2018-02-12Add basic CI integrationMax1-0/+42
Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
2018-02-12Add --enable-sanitize configure optionMax1-0/+9
Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
2018-02-12tests: enable / disable codec tests conditionallyVadim Yanitskiy4-4/+35
As the libosmogapk actually relies on external libraries for audio coding, we should enable / disable particular codec tests depending on the build configuration. Closes: OS#2926 Change-Id: Ie4711294c43ff88b17431615883abf96d1ae02a6
2018-02-02src/ fix osmo-gapk LDADD dependencyVadim Yanitskiy1-1/+1
This change fixes parallel building problem, when osmo-gapk was being compiled before its libosmogapk dependency: make[2]: *** No rule to make target '../src/', needed by 'osmo-gapk'. Stop. make[2]: *** Waiting for unfinished jobs.... For some reason, automake ignores a dependency if the full path is provided: $(top_builddir)/src/ while the relative path solves the problem: Closes: OS#2907 Change-Id: I3fdd1731bd372bbb42fe57981e757386e8ede0f0
2018-01-17Merge branch 'fixeria/lib' into masterVadim Yanitskiy84-593/+2514
The previous GAPK implementation was represented by a single executable. So, all audio transcoding operations were available only via calling the 'gapk' binary. This approach didn't allow external applications to benefit from using GAPK API directly. The following set of changes separates the common code into a shared library called 'libosmogapk', linking the 'gapk' binary against it: - 95e6664 Introduce a shared 'libosmogapk' library - 30209ce Install GAPK headers to '${includedir}/osmocom/gapk/' - a8d4657 Add an 'osmo_gapk' prefix to the exposed symbols - 40d59f1 Add a pkg-config manifest for libosmogapk - 4f0a47d Add the symbol export map for libosmogapk All memory management operations are now based on talloc library: - 3c20dac libosmogapk: use talloc for memory management - 5cabe1e osmo-gapk: use talloc for memory management Integrated Osmocom logging framework: - c35ba8a libosmogapk: use Osmocom logging framework - 4b7cd2c osmo-gapk: drop useless printf calls - 0fe18af osmo-gapk: use Osmocom logging framework - 11943bf osmo-gapk: adjust application verbosity Integrated GNU Autotest environment and basic test coverage: - f069eb3 Init automake test environment - 1fe6a9b tests: add procqueue test - 3e9e57f tests: add pq_file test - 9d2b15d tests: add pq_rtp test - f59f3f1 tests: add format / codec transcoding tests For more details, see commits history. Change-Id: I3c6d4a9d326ee49153e4ad83823d094831c112da
2018-01-15procqueue: introduce and use shared cat_name definitionsVadim Yanitskiy6-10/+19
Let's use the common string representation for item category names, defined in the shared header, instead of defining them in every file. Change-Id: Ie0c449d77fa383cad27f67b8ce902bd071342dbb
2018-01-09pq_alsa.c: fix memory leak after pq_cb_alsa_exit()Vadim Yanitskiy1-0/+1
Abusing the talloc hierarchical nature may cause some problems, e.g. on embedded systems with emulated talloc API. Let's release the memory allocated for a state explicitly. Change-Id: Ie675a92b1e52a4886dc447af19f65ff5e12a4c40
2018-01-08Fix BENCHMARK_STOP call for both AMR and FR codecsVadim Yanitskiy2-3/+3
The BENCHMARK_STOP should be called with a correct codec type and a correct operation type (encode or decode). Otherwise the results could be incorrect. Change-Id: Ie90e85ca8d9ec3175a58dde60525e0b7d6daf608
2018-01-08libgsmhr/libgsmhr.c: fix memory leak after gsmhr_exit()Vadim Yanitskiy1-0/+1
During the HR codec initialization, a part of the state is allocated, but not freed at exit. Let's fix this. Found during debugging with Valgrind: 4,932 bytes in 1 blocks are definitely lost in loss record 177 of 179 at 0x4C2AB80: malloc (in by 0x6381C8F: gsmhr_init (libgsmhr.c:63) by 0x526DF62: osmo_gapk_pq_queue_codec (pq_codec.c:48) by 0x401ACE: make_processing_chain (app_osmo_gapk.c:573) by 0x401ACE: main (app_osmo_gapk.c:765) Change-Id: Ie9ead89c2272782de8d928f29753e6a523cf8834
2017-12-31tests: add format / codec transcoding testsVadim Yanitskiy2-0/+221
This test group is intended to check the format / codec transcoding capabilities of the library. The reference files are used to ensure that encoding or decoding was successful. The following formats are currently being tested: - amr_efr - gsm - racal_hr - racal_fr - racal_efr - ti_hr - ti_fr - ti_efr - rtp_efr - rtp_hr_etsi - rtp_hr_ietf
2017-12-31osmo-gapk: fix I/O count check conditionVadim Yanitskiy1-1/+1
The stdin / stdout operation was broken by a new check condition, introduced by the 15fa605576a81803c57a144231e9e9720aa133a1.
2017-12-31tests: add pq_rtp testVadim Yanitskiy4-1/+377
This test is intended to check the RTP source / sink operability. To do this, two processing queues are being allocated: "generator": source/random -> sink/rtp "checker": source/rtp -> sink/checker The first one generates some amount of random bytes (payload), and stores them inside a buffer that is shared between both queues. After generation, a payload is being sent from the first queue via an RTP sink, and then being received by the second via an RTP source. As both queues do use a shared buffer, the last item of the second queue (named 'sink/checker') is able to compare a received payload with expected.
2017-12-31tests: add pq_file testVadim Yanitskiy5-0/+182
This test is intended to check the file source / sink operability. To do that, the following processing chain is being composed: source/file -> proc/dummy -> sink/file (stdout) The source item opens the sample file named 'io_sample.txt' for reading. The next processing item simply converts all uppercase latters to the lowercase. The last one writes the result to stdout. This processing cycle is being repeated several times with different block length values.
2017-12-31tests: add procqueue testVadim Yanitskiy4-0/+450
This test is intended to validate the processing queue management API. Moreover, the talloc debugging API is used to ensure that there are no memory leaks. First, four processing queues are being allocated. One of them is empty, while others have different count of items. Then the human-readable description is being generated for all of them. And finally, the processing and exit cllback are being tested. During the test execution, the talloc NULL-context tracking feature is enabled, allowing to observe every memory allocation within the libosmogapk, and to detect memory leaks.
2017-12-31Init automake test environmentVadim Yanitskiy32-1/+72
2017-12-31procqueue: allocate an output buffer as named chunkVadim Yanitskiy1-1/+1
The talloc_size() call sets the current file name and the current line number as name for chunk being allocated. This combination is not so informative during debugging, so let's use the static '.buffer' string as context name for item's output buffer.
2017-12-31procqueue: set talloc name and context for queue descriptionVadim Yanitskiy1-0/+10
Previously a queue description string was allocated without setting proper parental talloc context and proper name.
2017-12-31src/ export osmo_gapk_* with a wilcardVadim Yanitskiy1-47/+1
2017-12-31procqueue: use queue / item names in loggingVadim Yanitskiy6-16/+22
2017-12-31procqueue: separate queue check functionVadim Yanitskiy4-16/+58
In order to give advanced control over a processing queue, it would be better to have the checking function separated from the osmo_gapk_pq_prepare(). Moreover, this change introduces an additional 'strict' checking mode that requires a queue to have a source item first and a sink item in the last position.
2017-12-31procqueue: add item catedory and sub-category fieldsVadim Yanitskiy8-0/+37
This change adds two meta-information fields to the processing queue item structure. Both of them will be used for more detailed logging and for the human-readable processing queue description.
2017-12-31procqueue: add item type enum (source, sink, proc)Vadim Yanitskiy7-0/+20
There are currently three types of prcessing queue items: - source (file, alsa, rtp) - proc (format, codec) - sink (file, alsa, rtp) Let's assign corresponding type for each item. This would facilitate logging and the queue checking.
2017-12-31procqueue: add human-readable name to osmo_gapk_pqVadim Yanitskiy3-3/+13
Since this change, every processing queue may optionally have an associated human-readable name. If name is not required, NULL should be passed to the osmo_gapk_pq_create().
2017-12-31libosmogapk: drop an 'osmo' prefix from internal log variablesVadim Yanitskiy2-8/+8
It would be better to have an 'osmo_gapk' prefix for exposed symbols only. Both internal logging variables aren't exposed, so they shouldn't have one.
2017-12-31osmo-gapk: use talloc for memory managementVadim Yanitskiy1-3/+22
2017-12-31libosmogapk: introduce the internal root talloc contextVadim Yanitskiy7-4/+27
In order to simplify memory leak debugging, this change introduces the library's internal talloc context that may be changed by external application by calling the osmo_gapk_set_talloc_ctx().
2017-12-31libosmogapk: rename the 'logging.c' to 'common.c'Vadim Yanitskiy2-2/+3
There are not so much code, related to internal logging subsystem. So, there is no reason to keep a few lines in a dedicated file. In the future one may also be used for other routines.
2017-12-31libosmogapk: fix memory leak in both AMR and EFR codecsVadim Yanitskiy2-0/+4
The memory, allocated by codec_efr_init() / codec_amr_init(), was not cleaned after calling the codec_exit(). Found using talloc memory debugging API.
2017-12-31libosmogapk: use talloc for memory managementVadim Yanitskiy7-30/+36
2017-12-31osmo-gapk: fix I/O combinations checkVadim Yanitskiy1-9/+21
Previously both ALSA source and sink were out of attention. use actual bug report address in AC_INITVadim Yanitskiy1-1/+2
2017-12-31osmo-gapk: wait until sink finish processingVadim Yanitskiy1-0/+9
Previously the osmo-gapk application used to exit as soon as all the frames are processed, no matter has the sink finished its internal processing (e.g. ALSA playback).
2017-12-31src/pq_alsa.c: implement processing state callbackVadim Yanitskiy1-1/+8
Using the snd_pcm_avail_update() call from ALSA API it's possible to know, how much samples are still to be processed.
2017-12-31procqueue: add processing state callbackVadim Yanitskiy6-0/+6
In some cases it's required to wait for some queue items to finish processing. For example, the ALSA sink writes the audio samples to the buffer in non-blocking mode, so as soon as all of them will be written, a program may finish execution, causing the playback abort. To prevent that, this change extends the library's API, allowing each queue item to have a processing state callback that returns a positive integer if processing is not finished yet, and 0 otherwise.
2017-12-31osmo-gapk: abort the processing queue on SIGINTVadim Yanitskiy1-5/+12
Instead of immediately shutting down the application, it is better to try to break the processing queue first, and stop the execution immediately if second SIGINT is received.
2017-12-31osmo-gapk: adjust application verbosityVadim Yanitskiy1-4/+27
This change allows user to enable advanced verbosity using the '-v' command line option, which is disabled by default.