[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-cvs
Subject: [Datatype-cvs] mp4/video/renderer mp4vdfmt.cpp,1.18.8.29,1.18.8.30
From: huangrenjie () helixcommunity ! org
Date: 2010-12-30 21:19:02
Message-ID: 201012302119.oBULJHdq013928 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/datatype/mp4/video/renderer
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv20222
Modified Files:
Tag: hxclient_3_1_0_atlas
mp4vdfmt.cpp
Log Message:
Overview: With H264 PES stream, some hardware decoders have several decoded frames \
inside it at the time we do seek and when we send a new I frame, several frames \
belonging to previous GOP will be pushed out (they are supposed to be flushed). Those \
old frames stop video rendering. A workaround is to purge those frames after seeking.
Index: mp4vdfmt.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/video/renderer/mp4vdfmt.cpp,v
retrieving revision 1.18.8.29
retrieving revision 1.18.8.30
diff -u -d -r1.18.8.29 -r1.18.8.30
--- mp4vdfmt.cpp 18 Dec 2010 18:47:17 -0000 1.18.8.29
+++ mp4vdfmt.cpp 30 Dec 2010 21:18:59 -0000 1.18.8.30
@@ -60,6 +60,7 @@
#define MAX_NONKEY_CODED_FRAME_FALLBEHIND -800
+#define H264_EPS_FRAMES_ALLOWED_TO_SKIP 10
/****************************************************************************
* Includes
*/
@@ -124,7 +125,10 @@
, m_bCheckDummyFramePending(FALSE)
, m_bDrainFramePending(FALSE)
, m_bReInitDecoderPending(FALSE)
- , m_bPostSeekReinitDecoder(FALSE)
+ , m_bPostSeekWaitKeyFrame(FALSE)
+ , m_bSkipOldFramePostSeek(FALSE)
+ , m_ulKeyFrameTSPostSeek(0)
+ , m_ulSkippedFrameCnt(0)
{
HX_ASSERT(m_pCommonClassFactory);
HX_ASSERT(pMP4VideoRenderer);
@@ -823,16 +827,16 @@
{
_Reset();
CVideoFormat::Reset();
-
-#if defined(HELIX_FEATURE_DECODER_DYNAMIC_REINIT)
+
if (m_pMP4VideoRenderer && m_pMP4VideoRenderer->IsSeeking())
{
if (IsH264ESPayload())
{
- m_bPostSeekReinitDecoder = TRUE;
+ m_bPostSeekWaitKeyFrame = TRUE;
+ m_bSkipOldFramePostSeek = FALSE;
+ m_ulSkippedFrameCnt = 0;
}
- }
-#endif // HELIX_FEATURE_DECODER_DYNAMIC_REINIT
+ }
}
void CMP4VideoFormat::_Reset(void)
@@ -970,6 +974,13 @@
#endif // HELIX_FEATURE_DECODER_DYNAMIC_REINIT
}
+ if(pFrameToDecode && m_bPostSeekWaitKeyFrame)
+ {
+ m_bPostSeekWaitKeyFrame = FALSE;
+ m_bSkipOldFramePostSeek = TRUE;
+ m_ulKeyFrameTSPostSeek = pFrameToDecode->m_ulTime;
+ }
+
#if defined(HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES)
// discard late frames before they are decoded
@@ -1017,6 +1028,19 @@
// frame rate upsampling.
do
{
+ if(pDecodedPacket && m_bSkipOldFramePostSeek)
+ {
+ if(pDecodedPacket->timestamp != m_ulKeyFrameTSPostSeek && \
m_ulSkippedFrameCnt <= H264_EPS_FRAMES_ALLOWED_TO_SKIP) + {
+ ReleaseDecodedPacket(pDecodedPacket);
+ m_ulSkippedFrameCnt++;
+ }
+ else
+ {
+ m_bSkipOldFramePostSeek = FALSE;
+ }
+ }
+
m_pMP4VideoRenderer->BltIfNeeded();
// If frame is decoded, return it to be queued
@@ -1059,20 +1083,6 @@
m_pDecoder->ReInitCodec();
}
}
- else if (m_bPostSeekReinitDecoder)
- {
- m_bPostSeekReinitDecoder = FALSE;
- if (m_bDecoderMemMgt)
- {
- m_pDecoderMutex->Lock();
- status = ReInitializeDecoder();
- m_pDecoderMutex->Unlock();
- }
- else
- {
- m_pDecoder->ReInitCodec();
- }
- }
#endif // HELIX_FEATURE_DECODER_DYNAMIC_REINIT
status = m_pDecoder->Decode(pFrameToDecode,
@@ -1096,8 +1106,20 @@
}
pDecodedPacket = (HXCODEC_DATA*) m_pDecodedRngBuf->Get();
+
+ if(pDecodedPacket && m_bSkipOldFramePostSeek)
+ {
+ if(pDecodedPacket->timestamp != m_ulKeyFrameTSPostSeek && \
m_ulSkippedFrameCnt <= H264_EPS_FRAMES_ALLOWED_TO_SKIP) + {
+ ReleaseDecodedPacket(pDecodedPacket);
+ m_ulSkippedFrameCnt++;
+ }
+ else
+ {
+ m_bSkipOldFramePostSeek = FALSE;
+ }
+ }
}
-
#if !defined(HELIX_FEATURE_VIDEO_MPEG4_DISCARD_LATE_ENCODED_FRAMES)
if (pDecodedPacket && !m_pMP4VideoRenderer->IsUntimedMode())
{
_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic