summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorfrahaase <fra.haase@googlemail.com>2016-11-06 12:40:14 +0100
committerfrahaase <fra.haase@googlemail.com>2016-11-06 15:56:58 +0100
commitb2b5f9d897d1534f366b1b96fb10ad1de4f9ba5d (patch)
tree88fab2e74612cd3fdae87dd9b15008b5cb84c6f1 /res
parentbf01ff53f8d93d637981720331405e56f0b3b118 (diff)
ast_format: Adds an identifier for interleaved audio formats to the ast_format
Adds an identifier (with a getter and setter) to detect channels with interleaved audio. This is needed by the binaural bridge_softmix patch (ASTERISK-26292) and was already discussed here: http://lists.digium.com/pipermail/asterisk-dev/2016-October/075900.html The identifier can be set during fmtp parsing (to be seen in the res_format_attr_opus.c change). ASTERISK-26292 Change-Id: I359801cc5f98c35671c48dabc81a7f4ee1183d63
Diffstat (limited to 'res')
-rw-r--r--res/res_format_attr_opus.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_format_attr_opus.c b/res/res_format_attr_opus.c
index a3e48e3de..ad17dfb24 100644
--- a/res/res_format_attr_opus.c
+++ b/res/res_format_attr_opus.c
@@ -94,6 +94,7 @@ static int opus_clone(const struct ast_format *src, struct ast_format *dst)
ao2_bump(attr->data);
ast_format_set_attribute_data(dst, attr);
+ ast_format_set_channel_count(dst, ast_format_get_channel_count(src));
return 0;
}
@@ -145,6 +146,9 @@ static struct ast_format *opus_parse_sdp_fmtp(const struct ast_format *format, c
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_PTIME, &attr->ptime);
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_MAX_AVERAGE_BITRATE, &attr->maxbitrate);
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_STEREO, &attr->stereo);
+ if (attr->stereo) {
+ ast_format_set_channel_count(cloned, 2);
+ }
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_SPROP_STEREO, &attr->spropstereo);
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_CBR, &attr->cbr);
sdp_fmtp_get(attributes, CODEC_OPUS_ATTR_FEC, &attr->fec);
@@ -236,6 +240,10 @@ static struct ast_format *opus_getjoint(const struct ast_format *format1, const
if (!jointformat) {
return NULL;
}
+
+ if (ast_format_get_channel_count(format1) == 2 || ast_format_get_channel_count(format2) == 2) {
+ ast_format_set_channel_count(jointformat, 2);
+ }
attr_res = ast_format_get_attribute_data(jointformat);
attr_res->dtx = attr1->dtx || attr2->dtx ? 1 : 0;