obs-ffmpeg: Check avformat context before use
This commit is contained in:
parent
460c34aeaf
commit
d8812e0808
@ -578,6 +578,11 @@ static bool ffmpeg_data_init(struct ffmpeg_data *data,
|
||||
avformat_alloc_output_context2(&data->output, output_format,
|
||||
NULL, NULL);
|
||||
|
||||
if (!data->output) {
|
||||
blog(LOG_WARNING, "Couldn't create avformat context");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (is_rtmp) {
|
||||
data->output->oformat->video_codec = AV_CODEC_ID_H264;
|
||||
data->output->oformat->audio_codec = AV_CODEC_ID_AAC;
|
||||
@ -586,11 +591,6 @@ static bool ffmpeg_data_init(struct ffmpeg_data *data,
|
||||
set_encoder_ids(data);
|
||||
}
|
||||
|
||||
if (!data->output) {
|
||||
blog(LOG_WARNING, "Couldn't create avformat context");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!init_streams(data))
|
||||
goto fail;
|
||||
if (!open_output_file(data))
|
||||
|
Loading…
x
Reference in New Issue
Block a user