Commit Graph

16 Commits

Author SHA1 Message Date
Vadim Yanitskiy 9e7e889278 procqueue: use queue / item names in logging 2017-12-31 12:20:59 +01:00
Vadim Yanitskiy 459791c488 procqueue: add item catedory and sub-category fields
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-31 12:20:59 +01:00
Vadim Yanitskiy 408be3638b procqueue: add item type enum (source, sink, proc)
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-31 12:20:59 +01:00
Vadim Yanitskiy 3c20dac38c libosmogapk: use talloc for memory management 2017-12-31 12:20:59 +01:00
Vadim Yanitskiy a183ced71e src/pq_alsa.c: implement processing state callback
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-31 12:20:59 +01:00
Vadim Yanitskiy 1f6f807bb3 procqueue: add processing state callback
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-31 12:20:59 +01:00
Vadim Yanitskiy c35ba8a725 libosmogapk: use Osmocom logging framework
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-31 12:20:59 +01:00
Vadim Yanitskiy a8d46571ce Add an 'osmo_gapk' prefix to the exposed symbols
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-31 12:20:59 +01:00
Vadim Yanitskiy 30209ceddd Install GAPK headers to '${includedir}/osmocom/gapk/'
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-31 12:20:59 +01:00
Vadim Yanitskiy d5cfaa6a52 pq_alsa.c: print error message if device init fails 2017-09-02 17:03:06 +02:00
Vadim Yanitskiy 83aa99e7a9 pq_alsa.c: handle output buffer underrun
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-09-02 17:02:37 +02:00
Harald Welte ac3517e715 alsa/file input: return -1 on eof (short read)
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-28 20:06:01 +02:00
Harald Welte 0c655bce25 direct all log statements to stderr to avoid breaking stdout data out
The tool has the capability to be used in a pipe, so stdout should
recevie nothing else but actual codec/pcm data.
2017-05-28 19:44:26 +02:00
Harald Welte bd42eba35d Print some useful information while putting together the procqueue 2017-05-28 14:30:05 +02:00
Harald Welte 5912848d2e prepare gapk for dealing with variable-length frames
The existing architecture was modelled around fixed-length codec frame
sizes, which of course fails with multi-rate codecs such as AMR.
2017-05-28 10:44:06 +02:00
Harald Welte 2ae47af0be Add ALSA input/output support to GAPK
The ALSA source/sink uses the pcm-s16le format.
2017-05-28 01:56:33 +02:00