[asterisk-commits] dvossel: branch dvossel/opus_codec_ftw r330274 - in /team/dvossel/opus_codec_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 29 14:50:42 CDT 2011
Author: dvossel
Date: Fri Jul 29 14:50:38 2011
New Revision: 330274
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=330274
Log:
More opus codec settings in codecs.conf
Modified:
team/dvossel/opus_codec_ftw/channels/chan_sip.c
team/dvossel/opus_codec_ftw/configs/codecs.conf.sample
team/dvossel/opus_codec_ftw/main/format.c
Modified: team/dvossel/opus_codec_ftw/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/opus_codec_ftw/channels/chan_sip.c?view=diff&rev=330274&r1=330273&r2=330274
==============================================================================
--- team/dvossel/opus_codec_ftw/channels/chan_sip.c (original)
+++ team/dvossel/opus_codec_ftw/channels/chan_sip.c Fri Jul 29 14:50:38 2011
@@ -9514,6 +9514,22 @@
if (sscanf(fmtp_string, "useinbandfec=%30u", &val) == 1) {
ast_format_append(format, SILK_ATTR_KEY_FEC, val ? 1 : 0, AST_FORMAT_ATTR_END);
}
+ case AST_FORMAT_OPUS:
+ if (sscanf(fmtp_string, "maxcodedaudiobandwidth=%30u", &val) == 1) {
+ ast_format_append(format, OPUS_ATTR_KEY_SAMP_RATE, val, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "maxaveragebitrate=%30u", &val) == 1) {
+ ast_format_append(format, OPUS_ATTR_KEY_MAX_BITRATE, val, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "cbr=%30u", &val) == 1) {
+ ast_format_append(format, OPUS_ATTR_KEY_CBR, val ? 1 : 0, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "useinbandfec=%30u", &val) == 1) {
+ ast_format_append(format, OPUS_ATTR_KEY_FEC, val ? 1 : 0, AST_FORMAT_ATTR_END);
+ }
+ if (sscanf(fmtp_string, "usedtx=%30u", &val) == 1) {
+ ast_format_append(format, OPUS_ATTR_KEY_DTX, val ? 1 : 0, AST_FORMAT_ATTR_END);
+ }
break;
}
}
@@ -10889,6 +10905,22 @@
ast_str_append(a_buf, 0, "a=fmtp:%d useinbandfec=%u\r\n", rtp_code, val ? 1 : 0);
}
break;
+ case AST_FORMAT_OPUS:
+ if (!ast_format_get_value(format, OPUS_ATTR_KEY_SAMP_RATE, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d maxcodedaudiobandwidth=%u\r\n", rtp_code, val);
+ }
+ if (!ast_format_get_value(format, OPUS_ATTR_KEY_MAX_BITRATE, &val) && val > 5000 && val < 500000) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d maxaveragebitrate=%u\r\n", rtp_code, val);
+ }
+ if (!ast_format_get_value(format, OPUS_ATTR_KEY_CBR, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d cbr=%u\r\n", rtp_code, val ? 1 : 0);
+ }
+ if (!ast_format_get_value(format, OPUS_ATTR_KEY_FEC, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d useinbandfec=%u\r\n", rtp_code, val ? 1 : 0);
+ }
+ if (!ast_format_get_value(format, OPUS_ATTR_KEY_DTX, &val)) {
+ ast_str_append(a_buf, 0, "a=fmtp:%d usedtx=%u\r\n", rtp_code, val ? 1 : 0);
+ }
}
if (fmt.cur_ms && (fmt.cur_ms < *min_packet_size))
Modified: team/dvossel/opus_codec_ftw/configs/codecs.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/opus_codec_ftw/configs/codecs.conf.sample?view=diff&rev=330274&r1=330273&r2=330274
==============================================================================
--- team/dvossel/opus_codec_ftw/configs/codecs.conf.sample (original)
+++ team/dvossel/opus_codec_ftw/configs/codecs.conf.sample Fri Jul 29 14:50:38 2011
@@ -64,6 +64,8 @@
; there is a minor performance penalty for this
genericplc => true
+
+; ----- CUSTOM FORMATS ----
; Generate custom formats for formats requiring attributes.
; After defining the custom format, the name used in defining
; the format can be used throughout Asterisk in the format 'allow'
@@ -89,13 +91,32 @@
; Default Custom OPUS format definitions, only one custom OPUS format
; per sample rate is permitted.
+[opus48]
+type=opus
+samprate=48000 ; Sample rate of this opus format in hz.
+ ; 8000, 12000, 16000, 24000, 48000 are acceptable values.
+;fec=true ; turn on or off encoding with forward error correction.
+ ; On recommended, off by default.
+;maxbitrate=10000 ; Use the table below to make sure a useful bitrate is chosen
+ ; for maxbitrate. If not set or value is not within the bounds
+ ; of the encoder, a default value is chosen.
+ ;
+ ; sample rate | bitrate range
+ ; 8khz | 6000 - 20000 bps
+ ; 12khz | 7000 - 25000 bps
+ ; 16khz | 8000 - 30000 bps
+ ; 24khz | 18000- 28000 bps
+ ; 48khz | 24000- 32000 bps
+;dtx=true ; Encode using discontinuous transmission mode or not. Turning this
+ ; on will save bandwidth during periods of silence at the cost of
+ ; increased computational complexity. Off by default.
+;cbr=true ; Whether or not to encode with constant or variable bit rate. Constant
+ ; bit rate is disabled by default.
+
+
[opus16]
type=opus
samprate=16000
-
-[opus48]
-type=opus
-samprate=48000
; Default Custom SILK format definitions, only one custom SILK format per
; sample rate is allowed.
@@ -109,7 +130,7 @@
; The higher the percentage, the larger amount of bandwidth is
; used. Default is 0%, 10% is recommended when fec is in use.
-maxbitrate=10000 ; Use the table below to make sure a useful bitrate is choosen
+maxbitrate=10000 ; Use the table below to make sure a useful bitrate is chosen
; for maxbitrate. If not set or value is not within the bounds
; of the encoder, a default value is chosen.
;
@@ -123,13 +144,6 @@
; on will save bandwidth during periods of silence at the cost of
; increased computational complexity. Off by default.
-[silk12]
-type=silk
-samprate=12000
-maxbitrate=12000
-fec=true
-packetloss_percentage=10;
-
[silk16]
type=silk
samprate=16000
@@ -137,12 +151,21 @@
fec=true
packetloss_percentage=10;
-[silk24]
-type=silk
-samprate=24000
-maxbitrate=30000
-fec=true
-packetloss_percentage=10;
+; Uncomment silk24 to enable it on next restart
+;[silk12]
+;type=silk
+;samprate=12000
+;maxbitrate=12000
+;fec=true
+;packetloss_percentage=10;
+
+; Uncomment silk24 to enable it on next restart
+;[silk24]
+;type=silk
+;samprate=24000
+;maxbitrate=30000
+;fec=true
+;packetloss_percentage=10;
; Default custom CELT codec definitions. Only one custom CELT definition is allowed
@@ -155,10 +178,12 @@
; when it is set. Otherwise a default of framesize of 480 is assumed
; internally
+; Uncomment celt48 to enable it on next restart
;[celt48]
;type=celt
;samprate=48000
+; Uncomment celt32 to enable it on next restart
;[celt32]
;type=celt
;samprate=32000
Modified: team/dvossel/opus_codec_ftw/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/opus_codec_ftw/main/format.c?view=diff&rev=330274&r1=330273&r2=330274
==============================================================================
--- team/dvossel/opus_codec_ftw/main/format.c (original)
+++ team/dvossel/opus_codec_ftw/main/format.c Fri Jul 29 14:50:38 2011
@@ -1344,7 +1344,7 @@
ast_log(LOG_WARNING, "framesize '%s' at line %d of %s is not supported.\n",
var->value, var->lineno, FORMAT_CONFIG);
}
- } else if (!strcasecmp(var->name, "constant_bit_rate")) {
+ } else if (!strcasecmp(var->name, "cbr")) {
settings.cbr = ast_true(var->value) ? 1 : 0;
} else if (!strcasecmp(var->name, "dtx")) {
settings.usedtx = ast_true(var->value) ? 1 : 0;
More information about the asterisk-commits
mailing list