Commit Graph

179 Commits

Author SHA1 Message Date
Max 45d0fd66c3 Add git-review config
Change-Id: Id4304dc8248087c23aaf3a5d205cd341ed6a758a
2017-12-29 21:48:18 +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
Vadim Yanitskiy 6c42261cd2 test/common.sh: fix typo in gapk binary location 2017-08-31 13:06:55 +02:00
Harald Welte 1452203526 fmt_gsm: document that this format is also used for RTP 2017-05-29 11:25:03 +02:00
Harald Welte 2ba67e8c9e Add gapk testsuit
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-28 21:28:57 +02:00
Harald Welte 84f4f86fdf fmt_rtp_hr_ietf.c: Fix error encoding this format
We used the wrong length constant during encoding of RTP-HR IETF style.
2017-05-28 21:06:20 +02:00
Harald Welte fa93cec8a1 EFR codec fixup.
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-28 20:58:10 +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 d045f1766f procqueue.c: Logging unficiation (always use the [x] prefix) 2017-05-28 20:06:01 +02:00
Harald Welte 6c7fd7958c codac_amr: Remove printf() left from debugging/testing 2017-05-28 19:44:26 +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 7bdf34cc09 fmt_ti: fix lsb/msb mix-up in ti_hr_from_canon()
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-28 19:33:05 +02:00
Harald Welte 076d41aa79 print_help(): Fix formatting of help text 2017-05-28 16:22:43 +02:00
Harald Welte 848db7b662 Add support for RTP with GSM-HR payload according to RFC5993
This is incompatible with the ETSI TS 101 318 format!
2017-05-28 16:18:09 +02:00
Harald Welte dc3589a6be Add support for RTP with GSM-HR payload according to ETSI TS 101 318 2017-05-28 16:18:09 +02:00
Harald Welte f62e7a4936 Add "rtp-efr" format support for RTP payload according to RFC3551 4.5.9
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-28 16:18:09 +02:00
Harald Welte 526fc6e5e9 Fix HR codec block sizes
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-28 16:18:09 +02:00
Harald Welte bd42eba35d Print some useful information while putting together the procqueue 2017-05-28 14:30:05 +02:00
Harald Welte 495c694781 print meaningful error messages if something goes wrong in main/pq 2017-05-28 14:30:05 +02:00
Harald Welte 8b01f0ca05 Add AMR codec support
After merging this change, there is support for the AMR codec (by means
of libopencore-amr, which is already used for EFR).

In terms of gapk formats, we introdude
* the "amr-opencore" format, which serves both as the canonical format,
  and as the input format to opencore-amrnb itself.
* the "rtp-amr" format, which is the payload of RFC4867 octet-aligned mode

You can use the following command for a real-time RTP playback for AMR
frames:
  ./gapk -I 0.0.0.0/30000 -f rtp-amr -A default -g rawpcm-s16le
2017-05-28 14:29:59 +02:00
Harald Welte 494d92c3c7 more API documentation 2017-05-28 10:44:10 +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 62688b60c2 introduce #defines for canonical length + use them 2017-05-28 10:20:26 +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
Harald Welte 07d691314c RTP: give meaningful error messages if something fails
In fact, it should probably be better to silently ignore all those
errors as opposed to aborting the entire processing queue?  But that's
for another patch...
2017-05-28 01:56:33 +02:00
Harald Welte f3d2ad6a19 add some more comments throughout the code 2017-05-27 16:42:14 +02:00
Sylvain Munaut d192d8c017 benchmark: Fix cpuid clobbering
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2016-01-01 13:17:37 +01:00
Sylvain Munaut db94df5f9c main: Fixup the help screen
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 13:06:40 +01:00
Sylvain Munaut c0f0342596 libgsmhr: Make it safe to decode/encode different streams at once
Basically the reference code has a bunch of global state.
With some minimal patchihg (previous commit) we can ensure that all
that state is within .bss

So what we do it to save/restore the bss section between calls of the
reference code so we can process several in // and we don't have to
completely fix all reference to global state in the reference codec.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:55:03 +01:00
Sylvain Munaut 5e2e0442e0 libgsmhr: Add some code cleanup / speedup patches for reference codec
Mostly this will help witht the upcoming bss switcheroo patch

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:55:03 +01:00
Sylvain Munaut 59a6c2dc62 libgsmhr: Use patch instead of 'sed'
Patches are without function-name and without context to minimize what
we have to include.

The current patchset does exactly what the previous 'sed' did, but this
will make it easier to add more.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:55:03 +01:00
Sylvain Munaut 04a705f419 libgsmhr: Fix parallel build dependency
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:55:03 +01:00
Sylvain Munaut cddc91428f libgsmhr: fix Makefile.am dependency on source download
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:44:37 +01:00
Sylvain Munaut 8966846f3e libgsmhr/fetch_sources: Only use the filename and not any path
There shouldn't be any but somebody might be nasty :p

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:44:37 +01:00
Sylvain Munaut ac967d20fd build: Don't build static libraries
They won't be supported anyway when using the 'bss switcheroo' hack
for libgsmhr

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:44:37 +01:00
Sylvain Munaut ea1c6c61f4 build: Use autotools 'subdir-objects' option
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 11:44:37 +01:00
Sylvain Munaut d392a89cc8 benchmark: Make sure to print to stderr
stdout can be used for data output ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-12-30 10:45:22 +01:00
Harald Welte d72b0f654f ensure all gapk header files are included in 'dist' 2015-11-05 21:41:09 +01:00
Harald Welte bb782d98f3 Fix dist / distcheck targets by including fetch_sources.py in EXTRA_DIST 2015-11-05 21:37:57 +01:00
Harald Welte 0790f03eb9 add git-version-gen to auto-generate version from git repo tags 2015-11-05 21:25:32 +01:00
Harald Welte 7a04624563 Add cycle benchmarking support
This enables benchmarking of the codec.  It will print
the amount of CPU cycles needed for encoding/decoding a single
20ms frame on average.
2014-05-08 19:18:01 +02:00
Sylvain Munaut 8b5e0c7b81 libgsmhr: Update source location
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-12-13 15:41:07 +01:00
Sylvain Munaut 2c8b3fd281 build: Use AM_CPPFLAGS in Makefile.am
Since automake 1.13 INCLUDES is depricates and causes a warning

Inspired from similar patches by Alexander Huemer for other osmocom
projects

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-06-17 08:53:21 +02:00
Harald Welte e7e12cc9aa gapk: make sure the output file is closed/flushed on ctrl+c
This is useful particularly in case you are reading from RTP and writing
to a file, and don't want truncated codec frames in your file.
2013-02-11 11:47:56 +01:00
Harald Welte ce94d971e1 gapk: Add support for RTP input/output streams
Instead of having only file-based I/O, this enables gapk to receive and
send RTP streams, e.g. from live GSM network equipment like
sysmoBTS/nanoBTS.

Support is currently simplistic.  On transmit, there is hard-coded codec
type of full-rate GSM.  On receive-side, we should auto-detect the
format based on frame size and/or payload type, but we don't do that yet
at all.
2013-02-11 11:38:23 +01:00
Harald Welte f7f0c91ca8 gapk main: move fh_in and fh_out to sub-structures in a union
this is done in preparation to provide something else but file
input/output.
2013-02-11 09:26:36 +01:00
Sylvain Munaut db837250de codec: Fix opencore nb include path
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2012-12-08 19:14:11 +01:00
Sylvain Munaut 19428ca7bf autotools: Add AC_LANG_SOURCE required for autotools >= 2.68
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-09-30 12:15:12 +02:00
Sylvain Munaut e2c5719d74 format/fmt_ti: Add support for EFR variant
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-02-25 18:12:25 +01:00