aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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-02src/Makefile.am: 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/libosmogapk.la', 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/libosmogapk.la while the relative path solves the problem: libosmogapk.la Closes: OS#2907 Change-Id: I3fdd1731bd372bbb42fe57981e757386e8ede0f0
2018-01-17Merge branch 'fixeria/lib' into masterVadim Yanitskiy29-382/+852
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 Yanitskiy3-3/+6
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
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-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/libosmogapk.map: 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 Yanitskiy3-16/+57
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 Yanitskiy7-0/+32
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 Yanitskiy6-0/+12
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 Yanitskiy2-2/+9
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 Yanitskiy1-4/+4
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 Yanitskiy6-4/+26
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.
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 Yanitskiy5-0/+5
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.
2017-12-31osmo-gapk: use Osmocom logging frameworkVadim Yanitskiy1-30/+30
2017-12-31osmo-gapk: drop useless printf callsVadim Yanitskiy1-2/+2
The printf() writes the text into stdout, which may be undesirable in some use cases. Moreover, the printed information was redundant. So, let's drop such calls.
2017-12-31libosmogapk: use Osmocom logging frameworkVadim Yanitskiy10-17/+89
Since this change, the libosmogapk uses the Osmocom logging framework. By default, logging is disabled and could be enabled by the external applications calling the osmo_gapk_log_init() with a desired log target as an argument.
2017-12-31osmo-gapk: use more convenient name for the source fileVadim Yanitskiy2-1/+1
Since GAPK package contains a library and the representative osmo-gapk application, the 'main.c' looks a bit confusing. Let's use the common naming scheme.
2017-12-31osmo-gapk: create a common shutdown functionVadim Yanitskiy1-14/+18
Previously the code intended to shutdown the osmo-gapk application was repeated two times. It's better to have a single function.
2017-12-31osmo-gapk: add an option to enable / disable benchmarkVadim Yanitskiy1-3/+13
If the codec benchmarking is required in particular case, it could be activated by a special command line option introduced by this change.
2017-12-31procqueue: use linuxlist to store queue itemsVadim Yanitskiy1-45/+59
The usage of linuxlist is more flexible than having a limited array of pointers. This approach allows to have as much items in a processing queue as required.
2017-12-31procqueue: use uint8_t as output buffer typeVadim Yanitskiy1-1/+1
2017-12-31procqueue: store output buffers inside queue itemsVadim Yanitskiy1-6/+6
An output buffer belongs to its queue item, so it will be more correctly to store its pointer inside the osmo_gapk_pq_item.
2017-12-31Add the symbol export map for libosmogapkVadim Yanitskiy2-0/+46
2017-12-31benchmark: add functions to get cycle and frame countVadim Yanitskiy2-19/+57
To simplify the benchrarking process via the library API, this change introduces two new functions, which are intended to provide total cycle and frame count.
2017-12-31benchmark: allocate memory dynamicallyVadim Yanitskiy2-2/+39
Having statically allocated memory for benchmark data of every codec causes high memory usage, especially if actual benchmarking is not required for a particular use case. Instead of that, let's provide an optional opportunity to enable benchmarking for a particular codec by calling the osmo_gapk_bench_enable(). The required amount of memory would be allocated, and then can be freed by calling the osmo_gapk_bench_free() or manually.
2017-12-31benchmark: move benchmark impl to a private headerVadim Yanitskiy4-0/+4
There is no need to expose the implementation details of both BENCHMARK_START and BENCHMARK_STOP macros via public header. This change moves them to a separate private header 'bench.h'.
2017-12-31benchmark: move benchmark_dump() outside the libraryVadim Yanitskiy2-33/+33
The benchmark_dump() is only used by the osmo-gapk binary, and is intended to prepare and print benchmarking results to stderr, what is most likely unusable for the library users.
2017-12-31Add an 'osmo_gapk' prefix to the exposed symbolsVadim Yanitskiy26-129/+133
To avoid a naming conflict between libosmogapk and other projects during linkage, all the exposed symbols should have an unique prefix. Let's use 'osmo_gapk' for that.
2017-12-31procqueue: expose the processing queue struct definitionVadim Yanitskiy1-10/+0
To be able to use processing queues from outside, the pq struct should be shared in the corresponding header file.
2017-12-31Install GAPK headers to '${includedir}/osmocom/gapk/'Vadim Yanitskiy26-63/+63
To be able to use the library, external applications need to know, which symbols are exposed. This information is provided by header files, which are being installed to a system's ${includedir} since this change.
2017-12-31Add an 'osmo' prefix to the 'gapk' binaryVadim Yanitskiy1-4/+4
This is a common practice of all Osmocom executables to have an 'osmo' prefix. Let's follow this here too.
2017-12-31Introduce a shared 'libosmogapk' libraryVadim Yanitskiy1-15/+85
The previous GAPK implementation was represented as a single executable. So, all audio transcoding operations were available only by calling the 'gapk' binary. This approach didn't allow external applications to benefit from using GAPK API directly. Since there are some projects (such as GR-GSM and OsmocomBB), which are potential users of GAPK code base, it would be better to have all transcoding functions within a shared library. So, this change separates the common code into a shared library, named 'libosmogapk', and links the 'gapk' binary against one. Currently there are no shared headers, pkg-config manifest and the export map, but they will be done latter.
2017-09-02pq_alsa.c: print error message if device init failsVadim Yanitskiy1-3/+9
2017-09-02pq_alsa.c: handle output buffer underrunVadim Yanitskiy1-0/+8
On some systems the ALSA output buffer is pretty big, and if the audio samples are not being passed into the buffer quickly enough, it becomes starved for data, resulting in an error called underrun. Previously, when it happenned, GAPK used to stop processing with the following message (where X is a random number): [+] PQ: Adding ALSA output (dev='default', blk_len=320) [!] pq_execute(): abort, item returned -1 [+] Processed X frames According to the ALSA documentation, the pcm_handle changes its state when the problem happens, and should be recovered using the snd_pcm_prepare() call. This change actually does that.
2017-05-29fmt_gsm: document that this format is also used for RTPv0.4Harald Welte1-1/+1