[PATCH] libosmo-abis[master]: Add defines for FN to SAMPLE conversion

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Jun 6 08:13:53 UTC 2016


Review at  https://gerrit.osmocom.org/200

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
---
M include/osmocom/trau/osmo_ortp.h
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/00/200/1

diff --git a/include/osmocom/trau/osmo_ortp.h b/include/osmocom/trau/osmo_ortp.h
index 9512759..0d2696e 100644
--- a/include/osmocom/trau/osmo_ortp.h
+++ b/include/osmocom/trau/osmo_ortp.h
@@ -21,6 +21,15 @@
 /*! \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,

-- 
To view, visit https://gerrit.osmocom.org/200
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d8345352fb2ac76f71e88cb40f089fe3f9aae7e
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list