[Asterisk-code-review] format_cap: Include sample rates in format cap lists (asterisk[13])
Sean Bright
asteriskteam at digium.com
Fri Sep 11 16:58:11 CDT 2020
Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14899 )
Change subject: format_cap: Include sample rates in format cap lists
......................................................................
format_cap: Include sample rates in format cap lists
ASTERISK-28416 #close
Change-Id: I9bf336acb9e703d7e9851142c162eaea93fc09e6
---
M main/format_cap.c
1 file changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/14899/1
diff --git a/main/format_cap.c b/main/format_cap.c
index 86e8e1f..8a65c9e 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -748,12 +748,24 @@
for (i = 0; i < AST_VECTOR_SIZE(&cap->preference_order); ++i) {
int res;
struct format_cap_framed *framed = AST_VECTOR_GET(&cap->preference_order, i);
+ const char *name = ast_format_get_name(framed->format);
- res = ast_str_append(buf, 0, "%s%s", ast_format_get_name(framed->format),
- i < AST_VECTOR_SIZE(&cap->preference_order) - 1 ? "|" : "");
+ res = ast_str_append(buf, 0, "%s%s", i ? "|" : "", name);
if (res < 0) {
break;
}
+
+ /* Duplicated logic from main/translate.c - maybe we need a flag
+ * for this on the codec to make this less fragile? */
+ if (!strcmp(name, "slin") ||
+ !strcmp(name, "speex") ||
+ !strcmp(name, "silk")) {
+ res = ast_str_append(buf, 0, "%u",
+ ast_format_get_sample_rate(framed->format) / 1000);
+ if (res < 0) {
+ break;
+ }
+ }
}
ast_str_append(buf, 0, ")");
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14899
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I9bf336acb9e703d7e9851142c162eaea93fc09e6
Gerrit-Change-Number: 14899
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200911/5bce04b5/attachment.html>
More information about the asterisk-code-review
mailing list