Thanks Joshua, just to be clear that I understood it correctly. 1. We would extend ast_format [2] with the additional field `uint channel_count:1` 2. We would modify `opus_parse_sdp_fmtp` [1] to set `cloned->channel_count=2`on the `ast_format` to be returned.
Would this be acceptable or is this conceptually an issue? [1] https://github.com/asterisk/asterisk/blob/master/res/res_format_attr_opus.c#L129 [2] http://doxygen.asterisk.org/trunk/d0/d98/structast__format.html --- Dennis Guse On Tue, Oct 25, 2016 at 12:33 PM, Joshua Colp <jc...@digium.com> wrote: > Dennis Guse wrote: >> >> Hey, >> >> last week we started reworking the major patch [1] and could not solve >> one issue. >> At the moment, the softmix_bridge determines if interleaved stereo can >> be written by querying ast_format's attribute data if OPUS is used ([2]): >> >> ``` >> struct opus_attr *attr = ast_format_get_attribute_data(format); >> if (attr != NULL) { >> if (attr->stereo == 1) { >> *sample_rate = attr->maxplayrate; >> return 1; >> } >> } >> ``` >> >> In fact, this approach is conceptually flawed as it introduces a direct >> dependency between softmix_bridge and opus. >> To remove this dependency, we tried to attach this information to >> ast_codec (channel_count uint; default 1), but did not find a useful and >> working method to write the newly introduced field. >> We tried to set it in the res/res_format_attr_opus, ie, while parsing >> the fmtp for OPUS. >> Here, the ast_codec is const and we thus cannot be change. >> >> Any suggestions? >> Are we approaching the issue from a "correct" perspective? > > > The structure that is actually editable is the format (despite it being > const in the format attribute module - this was done because it was never > envisioned that a format attribute module would set anything directly on the > format), this data would need to be there. The codec structure is an > immutable structure which is shared by EVERY instance of a format that uses > the codec. That is why you can't edit it. > > > -- > Joshua Colp > Digium, Inc. | Senior Software Developer > 445 Jan Davis Drive NW - Huntsville, AL 35806 - US > Check us out at: www.digium.com & www.asterisk.org > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-dev mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-dev -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev