]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10480: [mod_av] fix crash recording an audio only stream to an rtmp stream
authorMike Jerris <mike@jerris.com>
Mon, 10 Jul 2017 17:38:34 +0000 (12:38 -0500)
committerMike Jerris <mike@jerris.com>
Mon, 10 Jul 2017 17:38:34 +0000 (12:38 -0500)
src/mod/applications/mod_av/avformat.c

index f7668cdcee8a2bef94616cbd89011721fabdfb30..295fa4aa5742ce114b9e58413bf278443456e427 100644 (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);
        }