summaryrefslogtreecommitdiff
path: root/modules/amr/sdp.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-06-14 12:05:01 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-06-14 12:05:01 +0200
commit2753cdfc7c3574a2d32f5b251cb857027074d3d7 (patch)
tree2e24aaf5044a9e721cdd82289020be46ca656fd7 /modules/amr/sdp.c
parente347c366253d74ffcd282c6c76e2f459f8ea7714 (diff)
amr: add support for octet-align mode
- this fixes compliance with RFC 4867 - this will break interop with older versions of baresip - Bandwidth-Efficient Mode can be added later fixes issue #37
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;
+}