[asterisk-commits] res/res format attr silk: Expose format attributes to other ... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 11 11:59:44 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: res/res_format_attr_silk: Expose format attributes to other modules
......................................................................
res/res_format_attr_silk: Expose format attributes to other modules
This patch adds the .get callback to the format attribute module, such
that the Asterisk core or other third party modules can query for the
negotiated format attributes.
Change-Id: Ia24f55cf9b661d651ce89b4f4b023d921380f19c
---
M res/res_format_attr_silk.c
1 file changed, 24 insertions(+), 0 deletions(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, approved
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/res/res_format_attr_silk.c b/res/res_format_attr_silk.c
index 3a8ca60..dcbbe4c 100644
--- a/res/res_format_attr_silk.c
+++ b/res/res_format_attr_silk.c
@@ -200,12 +200,36 @@
return cloned;
}
+static const void *silk_get(const struct ast_format *format, const char *name)
+{
+ struct silk_attr *attr = ast_format_get_attribute_data(format);
+ unsigned int *val;
+
+ if (!strcasecmp(name, "sample_rate")) {
+ val = &attr->samplerate;
+ } else if (!strcasecmp(name, "max_bitrate")) {
+ val = &attr->maxbitrate;
+ } else if (!strcasecmp(name, "dtx")) {
+ val = &attr->dtx;
+ } else if (!strcasecmp(name, "fec")) {
+ val = &attr->fec;
+ } else if (!strcasecmp(name, "packetloss_percentage")) {
+ val = &attr->packetloss_percentage;
+ } else {
+ ast_log(LOG_WARNING, "unknown attribute type %s\n", name);
+ return NULL;
+ }
+
+ return val;
+}
+
static struct ast_format_interface silk_interface = {
.format_destroy = silk_destroy,
.format_clone = silk_clone,
.format_cmp = silk_cmp,
.format_get_joint = silk_getjoint,
.format_attribute_set = silk_set,
+ .format_attribute_get = silk_get,
.format_parse_sdp_fmtp = silk_parse_sdp_fmtp,
.format_generate_sdp_fmtp = silk_generate_sdp_fmtp,
};
--
To view, visit https://gerrit.asterisk.org/1054
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia24f55cf9b661d651ce89b4f4b023d921380f19c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list