aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2017-12-31osmo-gapk: fix I/O combinations checkVadim Yanitskiy1-9/+21
Previously both ALSA source and sink were out of attention.
2017-12-31configure.ac: 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.
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 Yanitskiy13-17/+140
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 Yanitskiy3-2/+2
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 Yanitskiy2-47/+65
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 Yanitskiy2-7/+8
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-31procqueue: use unsigned int for I/O frame size fieldsVadim Yanitskiy1-2/+2
A frame size cannot be negative, so 'unsigned' is more suitable for frame size fields.
2017-12-31Add the symbol export map for libosmogapkVadim Yanitskiy3-0/+56
2017-12-31benchmark: add functions to get cycle and frame countVadim Yanitskiy3-19/+62
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 Yanitskiy4-4/+45
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: get rid of 'static inline' definitionVadim Yanitskiy1-18/+16
The usage of a 'static inline' function definition in the 'bench.h' is resulting in separate independent function definitions in each translation unit from which the header is included. This is increasing the size of compiled code unnecessarily.
2017-12-31benchmark: move benchmark impl to a private headerVadim Yanitskiy7-25/+58
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 Yanitskiy3-35/+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 Yanitskiy30-191/+215
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 Yanitskiy2-12/+9
To be able to use processing queues from outside, the pq struct should be shared in the corresponding header file.
2017-12-31Add a pkg-config manifest for libosmogapkVadim Yanitskiy4-1/+17
In order to make pkg-config 'see' the libosmogapk, a corresponding package description is required. For more details, see: https://autotools.io/pkgconfig/file-format.html
2017-12-31Use '#pragma once' instead of include guardVadim Yanitskiy7-29/+8
The most compilers today do support the '#pragma once', which is designed to cause the current source file to be included only once in a single compilation. One has several advantages, including: less code, avoidance of name clashes, and sometimes improvement in compilation speed. See: https://en.wikipedia.org/wiki/Pragma_once for details.
2017-12-31Install GAPK headers to '${includedir}/osmocom/gapk/'Vadim Yanitskiy35-76/+79
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 Yanitskiy4-11/+11
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-12-29Add git-review configMax1-0/+3
Change-Id: Id4304dc8248087c23aaf3a5d205cd341ed6a758a
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-08-31test/common.sh: fix typo in gapk binary locationVadim Yanitskiy1-1/+1
2017-05-29fmt_gsm: document that this format is also used for RTPv0.4Harald Welte1-1/+1
2017-05-28Add gapk testsuitHarald Welte27-0/+111
This testsuite takes a PCM auidio file and encodes from it every supported format, and compares that output with a known sample (from an earlier, trusted version of gakp, shipped as part of this project). I then re-decodes this file to PCM and also compares that with a shipped reference re-decode.
2017-05-28fmt_rtp_hr_ietf.c: Fix error encoding this formatHarald Welte1-1/+1
We used the wrong length constant during encoding of RTP-HR IETF style.
2017-05-28EFR codec fixup.Harald Welte1-2/+2
While EFR has a canonical format of 31 bytes, the codec_efr.c *does not* use that canonical format as input. Rather, it uses the format of .amr files with a 0x3C header as first byte. So the resulting encode/decode functions should not assume 31 bytes, but 32 bytes.
2017-05-28alsa/file input: return -1 on eof (short read)Harald Welte2-4/+4
This will permit for a more graceful error than the next element in the processing chain complaining that there's a 0-length input.
2017-05-28procqueue.c: Logging unficiation (always use the [x] prefix)Harald Welte1-3/+3
2017-05-28codac_amr: Remove printf() left from debugging/testingHarald Welte1-2/+0
2017-05-28direct all log statements to stderr to avoid breaking stdout data outHarald Welte5-18/+21
The tool has the capability to be used in a pipe, so stdout should recevie nothing else but actual codec/pcm data.
2017-05-28fmt_ti: fix lsb/msb mix-up in ti_hr_from_canon()Harald Welte1-1/+1
I noticed that ti-hr format doesn't pass an encode-decode-playback test, and discussion with tnt resulted in the following conclusion: 19:29 <@tnt> looking at fr and efr, it's always msb_xxx 19:30 <@tnt> and if I ever used it, then most likely it was for decoding meaning ti_hr_to_canon would have been used and not the other way around.
2017-05-28print_help(): Fix formatting of help textHarald Welte1-4/+2
2017-05-28Add support for RTP with GSM-HR payload according to RFC5993Harald Welte4-1/+85
This is incompatible with the ETSI TS 101 318 format!
2017-05-28Add support for RTP with GSM-HR payload according to ETSI TS 101 318Harald Welte4-1/+68
2017-05-28Add "rtp-efr" format support for RTP payload according to RFC3551 4.5.9Harald Welte4-1/+78
The RTP EFR payload is a bit like the FR payload: one nibble magic marker, then followed by the actual codec bits. So we need to add/remove that magic marker and shift the remainder by one nibble.
2017-05-28Fix HR codec block sizesHarald Welte3-5/+4
The ETSI reference codec actually uses an array of 20/22 16bit values rather than a "canonical" format. The conversion is what fmt_hr_ref.c is doing. However, codec_hr.c must then subsequently not check for the canonical input/output sizes, but those specific to it.
2017-05-28Print some useful information while putting together the procqueueHarald Welte5-0/+13
2017-05-28print meaningful error messages if something goes wrong in main/pqHarald Welte3-10/+34