summaryrefslogtreecommitdiff
path: root/modules/amr/sdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/amr/sdp.c')
-rw-r--r--modules/amr/sdp.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/amr/sdp.c b/modules/amr/sdp.c
new file mode 100644
index 0000000..e4b0cdf
--- /dev/null
+++ b/modules/amr/sdp.c
@@ -0,0 +1,56 @@
+/**
+ * @file amr/sdp.c AMR SDP Functions
+ *
+ * Copyright (C) 2010 - 2015 Creytiv.com
+ */
+
+#include <re.h>
+#include <baresip.h>
+#include "amr.h"
+
+
+static bool amr_octet_align(const char *fmtp)
+{
+ struct pl pl, oa;
+
+ if (!fmtp)
+ return false;
+
+ pl_set_str(&pl, fmtp);
+
+ if (fmt_param_get(&pl, "octet-align", &oa))
+ return 0 == pl_strcmp(&oa, "1");
+
+ return false;
+}
+
+
+int amr_fmtp_enc(struct mbuf *mb, const struct sdp_format *fmt,
+ bool offer, void *arg)
+{
+ const struct aucodec *ac = arg;
+ (void)offer;
+
+ if (!mb || !fmt || !ac)
+ return 0;
+
+ return mbuf_printf(mb, "a=fmtp:%s octet-align=1\r\n",
+ fmt->id);
+}
+
+
+bool amr_fmtp_cmp(const char *lfmtp, const char *rfmtp, void *arg)
+{
+ const struct aucodec *ac = arg;
+ (void)lfmtp;
+
+ if (!ac)
+ return false;
+
+ if (!amr_octet_align(rfmtp)) {
+ info("amr: octet-align mode is required\n");
+ return false;
+ }
+
+ return true;
+}