aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-06-06 10:09:06 +0200
committerHarald Welte <laforge@gnumonks.org>2016-06-06 10:05:53 +0000
commitc42c2ca8e00ea5602cdccfaf73ec9fe097c529af (patch)
treef9733d5782b7ca38f90330b5a01ce75fecbf4643
parent73b9bc72ac07d4dd6369001e4b0fa8cf7e53ccb7 (diff)
Add defines for FN to SAMPLE conversion
Add defines necessary to correctly convert number of TDMA frames into number of voice samples. Defines are proposed by Harald in comments on gerrit. Change-Id: I1d8345352fb2ac76f71e88cb40f089fe3f9aae7e Related: OS#1562 Reviewed-on: https://gerrit.osmocom.org/200 Tested-by: Jenkins Builder Reviewed-by: Harald Welte <laforge@gnumonks.org>
-rw-r--r--include/osmocom/trau/osmo_ortp.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
index cec0d2e..eb53a41 100644
--- a/include/osmocom/trau/osmo_ortp.h
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -22,6 +22,15 @@ struct _RtpSession;
/*! \brief Osmocom pseudo-static paylaod type for Adaptive Multi Rate (AMR) */
#define RTP_PT_AMR 98
+#define GSM_VOICE_SAMPLE_RATE_HZ 8000
+#define GSM_VOICE_SAMPLES_PER_MS (GSM_VOICE_SAMPLE_RATE_HZ / 1000)
+#define GSM_VOICE_MULTIFRAME 26
+#define GSM_RTP_FRAME_DURATION_MS 20
+#define GSM_SAMPLES_PER_RTP_FRAME (GSM_RTP_FRAME_DURATION_MS * GSM_VOICE_SAMPLES_PER_MS)
+#define GSM_TDMA_FRAME_MS (120 / GSM_VOICE_MULTIFRAME)
+#define GSM_MS_TO_SAMPLES(ms) (ms * GSM_VOICE_SAMPLES_PER_MS)
+#define GSM_FN_TO_MS(fn) (fn * GSM_TDMA_FRAME_MS)
+
/*! \brief Parameter to osmo_rtp_socket_param_set() */
enum osmo_rtp_param {
OSMO_RTP_P_JITBUF = 1,