generic-pc: avoid segfault

Origin commit data
------------------
Branch: master
Commit: bde8cb43c8
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-05-12 (Sun, 12 May 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-05-12 14:47:02 +02:00
committed by vanhofen
parent 7b1f9d3983
commit 7584a2db7f

View File

@@ -400,6 +400,11 @@ void cAudio::run()
hal_info("%s: avcodec_open2() failed\n", __func__); hal_info("%s: avcodec_open2() failed\n", __func__);
goto out; goto out;
} }
if(p->sample_rate == 0 || p->channels == 0){
av_get_sample_fmt_string(tmp, sizeof(tmp), c->sample_fmt);
hal_info("Header missing %s, sample_fmt %d (%s) sample_rate %d channels %d\n",avcodec_get_name(p->codec_id), c->sample_fmt, tmp, p->sample_rate, p->channels);
goto out2;
}
frame = av_frame_alloc(); frame = av_frame_alloc();
if (!frame) { if (!frame) {
hal_info("%s: av_frame_alloc failed\n", __func__); hal_info("%s: av_frame_alloc failed\n", __func__);