dvdplayer: combine two error checks and add parameter to log
authorJoakim Plate <elupus@ecce.se>
Sat, 9 Nov 2013 18:34:03 +0000 (19:34 +0100)
committerJoakim Plate <elupus@ecce.se>
Sun, 10 Nov 2013 15:28:24 +0000 (16:28 +0100)
xbmc/cores/dvdplayer/DVDPlayerAudio.cpp

index 4d5129b..d310aca 100644 (file)
@@ -274,19 +274,10 @@ int CDVDPlayerAudio::DecodeFrame(DVDAudioFrame &audioframe, bool bDropPacket)
 
       int len = m_pAudioCodec->Decode(m_decode.data, m_decode.size);
       m_audioStats.AddSampleBytes(m_decode.size);
-      if (len < 0)
+      if (len < 0 || len > m_decode.size)
       {
         /* if error, we skip the packet */
-        CLog::Log(LOGERROR, "CDVDPlayerAudio::DecodeFrame - Decode Error. Skipping audio packet");
-        m_decode.Release();
-        m_pAudioCodec->Reset();
-        return DECODE_FLAG_ERROR;
-      }
-
-      // fix for fucked up decoders
-      if( len > m_decode.size )
-      {
-        CLog::Log(LOGERROR, "CDVDPlayerAudio:DecodeFrame - Codec tried to consume more data than available. Potential memory corruption");
+        CLog::Log(LOGERROR, "CDVDPlayerAudio::DecodeFrame - Decode Error. Skipping audio packet (%d)", len);
         m_decode.Release();
         m_pAudioCodec->Reset();
         return DECODE_FLAG_ERROR;