[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-datatype-dev
Subject: [datatype-dev] CR/CN: Do RTP packet checks on per-stream basis in
From: Eric Hyche <ehyche () real ! com>
Date: 2010-02-26 0:39:35
Message-ID: EA2E1DE4-0C73-4D8F-80EC-4007A98F1BAB () real ! com
[Download RAW message or body]
Description
------------------------------------------
Previously the mp4 file writer assumed that if one stream used RTP packets
that all streams did. When one stream used RTP packets and the other did not,
then this lead to a crash. This change removes this assumption and does RTP
packet checks on a per-stream basis.
Files Modified
-------------------------------------
datatype\mp4\filewriter\mp4sm.cpp
datatpye\mp4\filewriter\mp4sm.h
Branches
----------------------------------
HEAD only
Index: mp4sm.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4sm.cpp,v
retrieving revision 1.26
diff -u -w -r1.26 mp4sm.cpp
--- mp4sm.cpp 25 Feb 2010 22:45:04 -0000 1.26
+++ mp4sm.cpp 26 Feb 2010 00:36:07 -0000
@@ -599,6 +599,8 @@
, m_bHaveSeenFirstPacket(FALSE)
, m_bIsAudio(FALSE)
, m_bIsVideo(FALSE)
+ , m_bHaveDoneRTPCheck(FALSE)
+ , m_bUsingRTPPackets(FALSE)
, m_ulFirstTimestamp(0)
, m_ulLastTimestamp(0)
, m_ulLastTimestampDelta(0)
@@ -646,7 +648,6 @@
, m_uiByteCount(0)
, m_uiReservedBlockCount(0)
, m_ulFirstTimestamp(0)
- , m_eIsRtp(UNCHECKED)
, m_bMoovAtEnd(FALSE)
, m_bForceMoovFirst(FALSE)
, m_pMvhd(NULL)
@@ -1053,7 +1054,7 @@
HXBOOL bFlushPackets = FALSE;
HXBOOL bIsKeyframe = FALSE;
- m_pStreamInfo[uiStreamNo].m_pStblManager->NotifyPacket(pPacket, (m_eIsRtp == \
IS_RTP), + m_pStreamInfo[uiStreamNo].m_pStblManager->NotifyPacket(pPacket, \
m_pStreamInfo[uiStreamNo].m_bUsingRTPPackets,
bFlushPackets, \
bIsKeyframe);
if (bFlushPackets)
@@ -2901,7 +2902,7 @@
// Check to see if we are using RTP Packets
CheckForRTPPackets(pPacket);
// Are we using RTP Packets?
- if (m_eIsRtp == IS_RTP)
+ if (m_pStreamInfo[ulOldStreamNumber].m_bUsingRTPPackets)
{
// We ARE using RTP packets
//
@@ -2997,21 +2998,36 @@
void
CMP4StreamMixer::CheckForRTPPackets(IHXPacket* pPacket)
{
- if (pPacket && m_eIsRtp == UNCHECKED)
+ if (pPacket)
+ {
+ // Get the stream number
+ UINT32 ulStreamNum = (UINT32) pPacket->GetStreamNumber();
+ // Make sure this is a valid stream number
+ if (ulStreamNum < m_ulStreamCount && m_pStreamInfo)
{
+ // Have we already done the RTP packet check?
+ if (!m_pStreamInfo[ulStreamNum].m_bHaveDoneRTPCheck)
+ {
+ // We have not done the RTP packet check yet
+ //
+ // Check to see if we can successfully QI this packet for \
IHXRTPPacket IHXRTPPacket* pRTPPacket = NULL;
HX_RESULT retVal = pPacket->QueryInterface(IID_IHXRTPPacket, (void**) \
&pRTPPacket); if (SUCCEEDED(retVal))
{
// We ARE using RTP packets
- m_eIsRtp = IS_RTP;
+ m_pStreamInfo[ulStreamNum].m_bUsingRTPPackets = TRUE;
}
else
{
// We are NOT using RTP packets
- m_eIsRtp = NOT_RTP;
+ m_pStreamInfo[ulStreamNum].m_bUsingRTPPackets = FALSE;
}
HX_RELEASE(pRTPPacket);
+ // Set the flag saying we've done the check
+ m_pStreamInfo[ulStreamNum].m_bHaveDoneRTPCheck = TRUE;
+ }
+ }
}
}
Index: mp4sm.h
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4sm.h,v
retrieving revision 1.18
diff -u -w -r1.18 mp4sm.h
--- mp4sm.h 25 Feb 2010 22:45:04 -0000 1.18
+++ mp4sm.h 26 Feb 2010 00:36:07 -0000
@@ -190,6 +190,8 @@
HXBOOL m_bHaveSeenFirstPacket;
HXBOOL m_bIsAudio;
HXBOOL m_bIsVideo;
+ HXBOOL m_bHaveDoneRTPCheck;
+ HXBOOL m_bUsingRTPPackets;
UINT32 m_ulFirstTimestamp;
UINT32 m_ulLastTimestamp;
UINT32 m_ulLastTimestampDelta;
@@ -318,15 +320,6 @@
CMP4Archiver* m_pArchiver;
- enum RTPPacketStream
- {
- UNCHECKED = 0,
- IS_RTP = 1,
- NOT_RTP = 2,
- };
-
- RTPPacketStream m_eIsRtp;
-
UINT32 m_uiByteCount;
UINT32 m_uiReservedBlockCount;
Eric Hyche (ehyche@real.com)
Principal Engineer
RealNetworks, Inc.
_______________________________________________
Datatype-dev mailing list
Datatype-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic