diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2017-01-28 09:17:16 +0100 |
---|---|---|
committer | Martijn Kaijser <mcm.kaijser@gmail.com> | 2017-01-29 09:47:25 +0100 |
commit | a3be5434e01303ee683ee1401cb4c6672b7944b2 (patch) | |
tree | 8b86dbfb022dd171966ebd7c4bc810399c6e5902 | |
parent | e80803a74474e964731631a37314bddb83e8b335 (diff) |
VideoPlayer: ffmpeg decoder - implement fail-safe for missing key frames
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 4129d3d6a7..df2445d295 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -596,7 +596,12 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p return VC_ERROR; if (pData) + { m_iLastKeyframe++; + // put a limit on convergence count to avoid huge mem usage on streams without keyframes + if (m_iLastKeyframe > 300) + m_iLastKeyframe = 300; + } if (m_pHardware) { @@ -703,6 +708,9 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p if (!m_started) { + if (m_iLastKeyframe >= 300 && m_pDecodedFrame->pict_type == AV_PICTURE_TYPE_I) + m_started = true; + av_frame_unref(m_pDecodedFrame); return VC_BUFFER; } @@ -712,10 +720,6 @@ int CDVDVideoCodecFFmpeg::Decode(uint8_t* pData, int iSize, double dts, double p else m_interlaced = false; - // put a limit on convergence count to avoid huge mem usage on streams without keyframes - if (m_iLastKeyframe > 300) - m_iLastKeyframe = 300; - //! @todo check if this work-around is still required if(m_pCodecContext->codec_id == AV_CODEC_ID_SVQ3) m_started = true; |