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

This commit is contained in:
Andrey Volk 2019-07-12 20:08:37 +04:00
parent 30f0ad63f4
commit af4316d8fb
2 changed files with 29 additions and 37 deletions

View File

@ -1962,8 +1962,6 @@ static void parse_profile(avcodec_profile_t *aprofile, switch_xml_t profile)
ctx = &aprofile->ctx;
if (!ctx) return;
for (param = switch_xml_child(profile, "param"); param; param = param->next) {
const char *name = switch_xml_attr(param, "name");
const char *value = switch_xml_attr(param, "value");

View File

@ -1638,7 +1638,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
context->offset = atoi(tmp);
}
if ((tmp = switch_event_get_header(handle->params, "video_time_audio"))) {
if (tmp && switch_false(tmp)) {
if (switch_false(tmp)) {
context->audio_timer = 0;
}
}
@ -1795,7 +1795,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
}
}
if (handle->stream_name && handle->mm.fps > 0.0f) {
if (handle->mm.fps > 0.0f) {
handle->mm.keyint = (int) 2.0f * handle->mm.fps;
}
}
@ -1809,8 +1809,6 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
const char *issplit = 0;
context->audio_st[0].channels = handle->channels;
context->audio_st[0].channels = handle->channels;
context->audio_st[1].sample_rate = handle->samplerate;
context->audio_st[1].sample_rate = handle->samplerate;
if (handle->channels > 1 && handle->params && (issplit = switch_event_get_header(handle->params, "channelsplit"))) {
@ -2528,7 +2526,7 @@ GCC_DIAG_ON(deprecated-declarations)
resize_check:
if (frame->img) {
if (frame->img && context->handle->mm.scale_w && context->handle->mm.scale_h) {
if (context->handle->mm.scale_w && context->handle->mm.scale_h) {
if (frame->img->d_w != context->handle->mm.scale_w || frame->img->d_h != context->handle->mm.scale_h) {
switch_img_fit(&frame->img, context->handle->mm.scale_w, context->handle->mm.scale_h, SWITCH_FIT_SCALE);
}
@ -2549,6 +2547,7 @@ static switch_status_t av_file_write_video(switch_file_handle_t *handle, switch_
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
av_file_context_t *context = (av_file_context_t *)handle->private_info;
switch_image_t *img = NULL;
if (!switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
return SWITCH_STATUS_FALSE;
@ -2589,9 +2588,6 @@ GCC_DIAG_ON(deprecated-declarations)
}
}
if (context->has_video) {
switch_image_t *img = NULL;
if (!context->eh.video_thread) {
switch_threadattr_t *thd_attr = NULL;
@ -2621,8 +2617,6 @@ GCC_DIAG_ON(deprecated-declarations)
context->vid_ready = 1;
}
}
end:
return status;
}