FS-10480: [mod_av] fix crash recording an audio only stream to an rtmp stream

This commit is contained in:
Mike Jerris 2017-07-10 12:38:34 -05:00
parent aba1068e09
commit 69cb420ca9
1 changed files with 2 additions and 2 deletions

View File

@ -1948,7 +1948,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
fmt = context->fc->oformat;
if ((tmp = switch_event_get_header(handle->params, "av_audio_codec"))) {
if (handle->params && (tmp = switch_event_get_header(handle->params, "av_audio_codec"))) {
if ((context->audio_codec = avcodec_find_encoder_by_name(tmp))) {
fmt->audio_codec = context->audio_codec->id;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "specified audio codec %s %s [%s]\n",
@ -1956,7 +1956,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
}
}
if (!strcasecmp(ext, "wav") || switch_true(switch_event_get_header(handle->params, "av_record_audio_only"))) {
if (!strcasecmp(ext, "wav") || (handle->params && switch_true(switch_event_get_header(handle->params, "av_record_audio_only")))) {
context->has_video = 0;
switch_clear_flag(handle, SWITCH_FILE_FLAG_VIDEO);
}