libosmocodec: implement ECU (Error Concealment Unit) for FR

When a bad GSM voice frame is received, it's being replaced
by a silence frame. This may cause unpleasant audio effects.

This change implements a functionality to craft a replacement
frame from the last known good frame. Currently, only FR is
supported, support for other codecs may be added latter.

Change-Id: I06a21f60db01bfe1c2b838f93866fad1d53fdcd1
diff --git a/include/Makefile.am b/include/Makefile.am
index 09f5ca6..f95d90c 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,6 +1,7 @@
 BUILT_SOURCES = osmocom/gsm/gsm0503.h
 
 nobase_include_HEADERS = \
+                       osmocom/codec/ecu.h \
                        osmocom/codec/codec.h \
                        osmocom/codec/gsm610_bits.h \
                        osmocom/core/application.h \
diff --git a/include/osmocom/codec/ecu.h b/include/osmocom/codec/ecu.h
new file mode 100644
index 0000000..f7a29a0
--- /dev/null
+++ b/include/osmocom/codec/ecu.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <osmocom/codec/codec.h>
+
+/* Codec independent ECU state */
+struct osmo_ecu_fr_state {
+	bool subsequent_lost_frame;
+	uint8_t frame_backup[GSM_FR_BYTES];
+};
+
+void osmo_ecu_fr_reset(struct osmo_ecu_fr_state *state, uint8_t *frame);
+int osmo_ecu_fr_conceal(struct osmo_ecu_fr_state *state, uint8_t *frame);