Fail mp3 loading when attempting to load invalid mp3s
This also adds a warning for unspecified MP3 loading error codes
(cherry picked from commit 936767deca
)
This commit is contained in:
parent
ec0085973f
commit
5db83defcd
1 changed files with 2 additions and 1 deletions
|
@ -159,7 +159,8 @@ void AudioStreamMP3::set_data(const PoolVector<uint8_t> &p_data) {
|
||||||
PoolVector<uint8_t>::Read src_datar = p_data.read();
|
PoolVector<uint8_t>::Read src_datar = p_data.read();
|
||||||
|
|
||||||
mp3dec_ex_t mp3d;
|
mp3dec_ex_t mp3d;
|
||||||
mp3dec_ex_open_buf(&mp3d, src_datar.ptr(), src_data_len, MP3D_SEEK_TO_SAMPLE);
|
int err = mp3dec_ex_open_buf(&mp3d, src_datar.ptr(), src_data_len, MP3D_SEEK_TO_SAMPLE);
|
||||||
|
ERR_FAIL_COND(err != 0);
|
||||||
|
|
||||||
channels = mp3d.info.channels;
|
channels = mp3d.info.channels;
|
||||||
sample_rate = mp3d.info.hz;
|
sample_rate = mp3d.info.hz;
|
||||||
|
|
Loading…
Reference in a new issue