提交 7afec393 authored 作者: Andrey Volk's avatar Andrey Volk

FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for mod_opus

上级 e0211e2c
...@@ -257,7 +257,6 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt ...@@ -257,7 +257,6 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt
if ((arg = strchr(data, '='))) { if ((arg = strchr(data, '='))) {
*arg++ = '\0'; *arg++ = '\0';
if (codec_settings) {
if (!strcasecmp(data, "useinbandfec")) { if (!strcasecmp(data, "useinbandfec")) {
codec_settings->useinbandfec = switch_true(arg); codec_settings->useinbandfec = switch_true(arg);
} }
...@@ -313,7 +312,6 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt ...@@ -313,7 +312,6 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt
} }
} }
} }
}
free(fmtp_dup); free(fmtp_dup);
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
...@@ -572,7 +570,7 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag ...@@ -572,7 +570,7 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
if (encoding) { if (encoding) {
/* come up with a way to specify these */ /* come up with a way to specify these */
int bitrate_bps = OPUS_AUTO; int bitrate_bps = OPUS_AUTO;
int use_vbr = opus_codec_settings.cbr ? !opus_codec_settings.cbr : opus_prefs.use_vbr ; int use_vbr = opus_codec_settings.cbr ? 0 : opus_prefs.use_vbr ;
int complexity = opus_prefs.complexity; int complexity = opus_prefs.complexity;
int plpct = opus_prefs.plpct; int plpct = opus_prefs.plpct;
int err; int err;
...@@ -623,8 +621,7 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag ...@@ -623,8 +621,7 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
audiobandwidth = switch_opus_encoder_set_audio_bandwidth(context->encoder_object,opus_codec_settings.maxplaybackrate); audiobandwidth = switch_opus_encoder_set_audio_bandwidth(context->encoder_object,opus_codec_settings.maxplaybackrate);
if (!switch_opus_show_audio_bandwidth(audiobandwidth,audiobandwidth_str)) { if (!switch_opus_show_audio_bandwidth(audiobandwidth,audiobandwidth_str)) {
memset(audiobandwidth_str,0,sizeof(audiobandwidth_str)); snprintf(audiobandwidth_str, sizeof(audiobandwidth_str), "%s", "OPUS_AUTO");
strncpy(audiobandwidth_str, "OPUS_AUTO",sizeof(audiobandwidth_str)-1);
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set audio bandwidth to [%s] based on maxplaybackrate value found in SDP or local config [%dHz]\n",audiobandwidth_str,opus_codec_settings.maxplaybackrate); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opus encoder: set audio bandwidth to [%s] based on maxplaybackrate value found in SDP or local config [%dHz]\n",audiobandwidth_str,opus_codec_settings.maxplaybackrate);
} }
...@@ -1090,9 +1087,7 @@ static switch_status_t opus_load_config(switch_bool_t reload) ...@@ -1090,9 +1087,7 @@ static switch_status_t opus_load_config(switch_bool_t reload)
} }
} }
if (xml) {
switch_xml_free(xml); switch_xml_free(xml);
}
return status; return status;
} }
...@@ -1131,7 +1126,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec) ...@@ -1131,7 +1126,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
b32 = ((opus_int32)((0.01) * ((opus_int64)1 << (16)) + 0.5)); b32 = ((opus_int32)((0.01) * ((opus_int64)1 << (16)) + 0.5));
LBRR_threshold_bitrate = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); LBRR_threshold_bitrate = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16);
if ((!real_target_bitrate || !LBRR_threshold_bitrate)) { if (!real_target_bitrate || !LBRR_threshold_bitrate) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opus encoder: error while controlling FEC params\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opus encoder: error while controlling FEC params\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
...@@ -1191,10 +1186,8 @@ static switch_status_t switch_opus_control(switch_codec_t *codec, ...@@ -1191,10 +1186,8 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
if (rtype) { if (rtype) {
*rtype = reply_type; *rtype = reply_type;
if (reply) {
*ret_data = (void *)reply; *ret_data = (void *)reply;
} }
}
} }
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论