diff options
author | fritsch <Peter.Fruehberger@gmail.com> | 2023-01-04 08:43:37 +0100 |
---|---|---|
committer | fuzzard <fuzzard@kodi.tv> | 2023-03-11 11:18:54 +1000 |
commit | 116ad7977baa1d16a85860b6bb6f322b61c1ea84 (patch) | |
tree | 6345df75354075e2da9fa67d911ae1a7a2db3e01 | |
parent | cfad925044a9424182e0e3f388cc595abc66ed07 (diff) | |
download | xbmc-116ad7977baa1d16a85860b6bb6f322b61c1ea84.tar.xz |
VideoPlayerCodec: Stop dividing by zero
When parsing a file failed so that needed fields, in our case frameSize
are not available a guess work like with m_channels or m_samplerate does
not help. Therefore fail early.
-rw-r--r-- | xbmc/cores/paplayer/VideoPlayerCodec.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/xbmc/cores/paplayer/VideoPlayerCodec.cpp b/xbmc/cores/paplayer/VideoPlayerCodec.cpp index 224b9bea57..a77a27dc60 100644 --- a/xbmc/cores/paplayer/VideoPlayerCodec.cpp +++ b/xbmc/cores/paplayer/VideoPlayerCodec.cpp @@ -172,7 +172,9 @@ bool VideoPlayerCodec::Init(const CFileItem &file, unsigned int filecache) // we have to decode initial data in order to get channels/samplerate // for sanity - we read no more than 10 packets int nErrors = 0; - for (int nPacket=0; nPacket < 10 && (m_channels == 0 || m_format.m_sampleRate == 0); nPacket++) + for (int nPacket = 0; + nPacket < 10 && (m_channels == 0 || m_format.m_sampleRate == 0 || m_format.m_frameSize == 0); + nPacket++) { uint8_t dummy[256]; size_t nSize = 256; @@ -230,6 +232,10 @@ bool VideoPlayerCodec::Init(const CFileItem &file, unsigned int filecache) if (NeedConvert(m_srcFormat.m_dataFormat)) { m_needConvert = true; + // if we don't know the framesize yet, we will fail when converting + if (m_srcFormat.m_frameSize == 0) + return false; + m_pResampler = ActiveAE::CAEResampleFactory::Create(); SampleConfig dstConfig, srcConfig; |