flvmux: Avoid crash when changing caps without both streams

mux->video_pad and mux->audio_pad can be NULL if the corresponding pad
has not been requested.
This commit is contained in:
Jan Alexander Steffens (heftig) 2019-06-19 12:28:22 +02:00
parent b18ad8b54c
commit 9a70ce87db
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5

View file

@ -1486,10 +1486,15 @@ gst_flv_mux_write_header (GstFlvMux * mux)
caps = gst_flv_mux_prepare_src_caps (mux,
&header, &metadata, &video_codec_data, &audio_codec_data);
} else {
GstBuffer **video_codec_data_p = NULL, **audio_codec_data_p = NULL;
if (mux->video_pad && mux->video_pad->info_changed)
video_codec_data_p = &video_codec_data;
if (mux->audio_pad && mux->audio_pad->info_changed)
audio_codec_data_p = &audio_codec_data;
caps = gst_flv_mux_prepare_src_caps (mux,
NULL, NULL,
(mux->video_pad->info_changed ? &video_codec_data : NULL),
(mux->audio_pad->info_changed ? &audio_codec_data : NULL));
NULL, NULL, video_codec_data_p, audio_codec_data_p);
}
}