Modified by: milko real.com
Date: 11:16:06
Project: Atlas
Synopsis: RTSP/RTP and MP4-Video fixes
Overview:
This submission includes the following corrections and
enhancements:
-> fixes omission in previous submission titled "CR:
RTSP, RTP and 3GPP
Adaptation fixes" that was still causing improper
etting of first
time-stamp and seq.number for pipleined PLAY commands in
seek or resume context
-> added tracking of RTSP PLAY command issued to the
server and context of
the commands (resume or seek) to add additional robustness
of handling
cases where servers fail to respond to every PLAY command
issued
-> moved update of the play range ahead of computation of
the RTP to NPT
time-stamp mapping to allow the computation to occur based
on the range
returend by the server as opposed the range requested by the
client.
-> corrected creation of lost packets for RTP streams so
that created
packets to support IHXRTPPacket interface. This violated
the rule of "if
any then all packet must support IHXRTPPacket
interface" thus causing
incorrect RTP time-stamp conversion in MPEG4 video
depacketizer in some
corner cases. The corner case included starting the stream
with a lost
packet, seeking and restarting the post-seek sequence with a
non-lost
packet. The outcome was a video hang.
-> added detailed logging to RTSP/RTP stack. Now full
set of RTSP/RTP log
statements is provided which allows for full analysis of
RTSP/RTP stack
behavior. The logging area is "RTSP".
-> Circumvented any processing of pre-seek packets in
base video renderer.
Any processing of such packets is undesireable in context of
video and it
can be potentially harmful if pre-seek packets contain
incorrect
time-stamps due to possible contamination of wrap-around
handling in
time-stamp converter objects which rely on input of roughly
contiguous time
stamps. The pre-seek packets in case of RTP tend to be
incorrect due to
re-established RTP to NPT mapping for post-seek packets. As
pre-seek
packets are useless for video, correcting the time-stamps
for RTP pre-seek
packets is only an academic and non-trivial excersize that
will not be
undertaken.
-> Increased robustness of MPEG4 video depacketizer by
removing the rest of
packet time-stamp smapling rate. This rest in combination
with bug
corrected under item 4 was the cause of MP4 video freeze
after seek in a
corner case described under item 4.
-> Corrected MPEG4 video depacketizer (RFC3016) to do
proper accounting of
consumed frames. Previously, it was possible for the
depacketizer to
miscount which was evident by an ASSERT and fewer frames
processed in total
(full scope of this error has not been examined).
Files Modified:
/datatype/mp4/payload/mp4vpyld.cpp,v
/protocol/rtsp/rtspclnt.cpp,v
/protocol/rtsp/pub/rtspclnt.h,v
/transport/common/system/rtsptran.cpp,v
/protocol/transport/common/system/pub/rtsptran.h,v
/protocol/transport/rtp/rtptran.cpp,v
/protocol/transport/rtp/pub/rtptran.h,v
/datatype/common/vidrend/vidrend.cpp,v
Image Size and Heap Use impact (Client -Only):
Insignificant.
Platforms and Profiles Affected:
All
Distribution Libraries Affected:
none
Distribution library impact and planned action:
n/a
Platforms and Profiles Build Verified:
win32-i386-vc7, helix-client-all-defines
Platforms and Profiles Functionality verified:
win32
Index: rtsp/rtspclnt.cpp
============================================================
=======
RCS file: /cvsroot/protocol/rtsp/rtspclnt.cpp,v
retrieving revision 1.204
diff -u -w -r1.204 rtspclnt.cpp
--- rtsp/rtspclnt.cpp 14 Nov 2006 21:25:17 -0000 1.204
+++ rtsp/rtspclnt.cpp 16 Nov 2006 21:34:31 -0000
 -4213,6
+4213,12 
UINT32 seqNo = m_pSession->getNextSeqNo(this);
rc = sendRequest(pMsg, seqNo);
+
+ if (SUCCEEDED(rc))
+ {
+ rc =
augmentRequestPendingReplyList(m_PlayRequestPendingReplyList
,
+ seqNo);
+ }
}
else
{
 -4357,7
+4363,8 
if (SUCCEEDED(rc))
{
- rc = augmentResumeRequestPendingReplyList(ulMsgSeqNum);
+ rc =
augmentRequestPendingReplyList(m_ResumeRequestPendingReplyLi
st,
+ ulMsgSeqNum);
}
m_pMutex->Unlock();
 -6059,7
+6066,6 
if(pTrans)
{
pTrans->setFirstSeqNum(uStreamNumber, uSeqNum);
-// pTrans->setFirstTimeStamp(uStreamNumber,
ulTimeStamp);
}
m_pMutex->Unlock();
 -6093,7
+6099,7 
if (RTPINFO_SEQ_RTPTIME == info)
{
pTrans->setFirstSeqNum(uStreamNumber,
uSeqNum, bOnPauseResume);
- pTrans->setFirstTimeStamp(uStreamNumber,
ulRTPTime, bOnPauseResume);
+ pTrans->setFirstTimeStamp(uStreamNumber,
ulRTPTime, FALSE, bOnPauseResume);
}
else if (RTPINFO_SEQ == info)
{
 -6101,7
+6107,7 
}
else if (RTPINFO_RTPTIME == info)
{
- pTrans->setFirstTimeStamp(uStreamNumber,
ulRTPTime, bOnPauseResume);
+ pTrans->setFirstTimeStamp(uStreamNumber,
ulRTPTime, FALSE, bOnPauseResume);
}
}
 -7568,10
+7574,95 
UINT16 seqNum = 0;
UINT32 ulRTPTime = 0;
const char* pControl = 0;
+ HXBOOL bIsResumeResponseThisRound;
RTPInfoEnum RTPErr;
HXBOOL bIsResumeResponse;
+ HXBOOL bIsPlayResponse;
+ UINT32 ulNumPlayResponsesTrimmed;
+
+ bIsResumeResponse =
trimRequestPendingReplyList(m_ResumeRequestPendingReplyList,
+ pMsg->seqNo());
+
+ bIsPlayResponse =
trimRequestPendingReplyList(m_PlayRequestPendingReplyList,
+ pMsg->seqNo(),
+ &ulNumPlayResponsesTrimmed);
+
+ // The response cannot be both play and resume response
+ HX_ASSERT(!(bIsResumeResponse &&
bIsPlayResponse));
+ HX_ASSERT(bIsResumeResponse || bIsPlayResponse);
+
+ if (!(bIsResumeResponse || bIsPlayResponse))
+ {
+ // We are not expecting PLAY/RESUME response - ignore it
+ return HXR_OK;
+ }
+
+ // Update range entries
+ // We want to update the play-range before setting
first time-stamp
+ // information in the transport to allow mapping to NPT
time to
+ // occur correctly.
+ MIMEHeader* pRange =
pMsg->getHeader("Range");
+ if (pRange)
+ {
+ pSeqValue = pRange->getFirstHeaderValue();
+
+ INT32 nFrom = 0, nTo = 0;
+
+ if (pSeqValue)
+ {
+ MIMEParameter* pParam =
pSeqValue->getFirstParameter();
+
+ if (pParam)
+ {
+ const char* pRange = (const char*)
pParam->m_attribute;
+ const char* pDash = NULL;
+ char* pStopString;
+ double dTemp;
+
+ if (pRange)
+ {
+ dTemp = strtod(pRange,
&pStopString);
+ nFrom = (INT32)(dTemp * 1000);
- bIsResumeResponse =
trimResumeRequestPendingReplyList(pMsg->seqNo());
+ pDash = strrchr(pRange, '-');
+ }
+
+ if (pDash)
+ {
+ dTemp = strtod(pDash + 1,
&pStopString);
+ nTo = (INT32)(dTemp * 1000);
+ }
+ }
+ }
+
+ if (!m_transportRequestList.IsEmpty())
+ {
+ RTSPTransportRequest* pRequest =
+
(RTSPTransportRequest*)m_transportRequestList.GetHead();
+
+ RTSPTransportInfo* pTransInfo =
pRequest->getFirstTransportInfo();
+
+ while(pTransInfo && nTo)
+ {
+ // set the range in transport...only for
RTP
+
pTransInfo->m_pTransport->RTSPTransport::setPlayRange(
(UINT32)nFrom, (UINT32)nTo);
+ pTransInfo =
pRequest->getNextTransportInfo();
+ }
+ }
+ }
+
+ // If server is operating correcty, we should never see
ulNumPlayResponsesTrimmed > 1
+ // or ulNumPlayResponsesTrimmed != 0 when
bIsResumeResponse == TRUE.
+ // The logic here is implemented to make client as
robust as possible in cases
+ // where server fails to respond to some PLAY/RESUME
requests.
+ while ((ulNumPlayResponsesTrimmed > 0) ||
bIsResumeResponse)
+ {
+ bIsResumeResponseThisRound = FALSE;
+ if ((ulNumPlayResponsesTrimmed == 0) &&
bIsResumeResponse)
+ {
+ bIsResumeResponseThisRound = TRUE;
+ bIsResumeResponse = FALSE;
+ }
if (pSequence)
{
 -7614,7
+7705,7 
// Without pInfo, we do not know the streamID
to set RTPInfo to.
if ((RTPINFO_ERROR != RTPErr) && pInfo)
{
- _SetRTPInfo(streamID, seqNum, ulRTPTime,
RTPErr, bIsResumeResponse);
+ _SetRTPInfo(streamID, seqNum, ulRTPTime, RTPErr,
bIsResumeResponseThisRound);
}
pSeqValue = pSequence->getNextHeaderValue();
 -7623,7
+7714,13 
// Meke sure all streams involved are aware that
// RTP Info has been processed and no more info is
comming.
- NotifyStreamsRTPInfoProcessed(bIsResumeResponse);
+ NotifyStreamsRTPInfoProcessed(bIsResumeResponseThisRound);
+
+ if (ulNumPlayResponsesTrimmed > 0)
+ {
+ ulNumPlayResponsesTrimmed--;
+ }
+ }
m_bSeqValueReceived = TRUE;
 -7653,57
+7750,6 
}
}
- // Update range entries
- MIMEHeader* pRange =
pMsg->getHeader("Range");
- if (pRange)
- {
- pSeqValue = pRange->getFirstHeaderValue();
-
- INT32 nFrom = 0, nTo = 0;
-
- if (pSeqValue)
- {
- MIMEParameter* pParam =
pSeqValue->getFirstParameter();
-
- if (pParam)
- {
- const char* pRange = (const char*)
pParam->m_attribute;
- const char* pDash = NULL;
- char* pStopString;
- double dTemp;
-
- if (pRange)
- {
- dTemp = strtod(pRange,
&pStopString);
- nFrom = (INT32)(dTemp * 1000);
-
- pDash = strrchr(pRange, '-');
- }
-
- if (pDash)
- {
- dTemp = strtod(pDash + 1,
&pStopString);
- nTo = (INT32)(dTemp * 1000);
- }
- }
- }
-
- if (!m_transportRequestList.IsEmpty())
- {
- RTSPTransportRequest* pRequest =
-
(RTSPTransportRequest*)m_transportRequestList.GetHead();
-
- RTSPTransportInfo* pTransInfo =
pRequest->getFirstTransportInfo();
-
- while(pTransInfo && nTo)
- {
- // set the range in transport...only for
RTP
-
pTransInfo->m_pTransport->RTSPTransport::setPlayRange(
(UINT32)nFrom, (UINT32)nTo);
- pTransInfo =
pRequest->getNextTransportInfo();
- }
- }
- }
-
return m_pResp->HandlePlayResponse(HXR_OK);
}
 -8658,7
+8704,8 
clearTransportRequestList();
clearUDPResponseHelperList();
ClearPreSetupResponseQueueMap();
- clearResumeRequestPendingReplyList();
+
clearRequestPendingReplyList(m_ResumeRequestPendingReplyList
);
+
clearRequestPendingReplyList(m_PlayRequestPendingReplyList);
HX_RELEASE(m_pConnectAddr);
HX_RELEASE(m_pPeerAddr);
 -8794,35
+8841,39 
}
void
-RTSPClientProtocol::clearResumeRequestPendingReplyList()
+RTSPClientProtocol::clearRequestPendingReplyList(CHXSimpleL
ist& requestPendingReplyList)
{
UINT32* pDeadCmdSeqNum;
- while (!m_ResumeRequestPendingReplyList.IsEmpty())
+ while (!requestPendingReplyList.IsEmpty())
{
- pDeadCmdSeqNum = (UINT32*)
m_ResumeRequestPendingReplyList.RemoveHead();
+ pDeadCmdSeqNum = (UINT32*)
requestPendingReplyList.RemoveHead();
delete pDeadCmdSeqNum;
}
}
HXBOOL
-RTSPClientProtocol::trimResumeRequestPendingReplyList(UINT3
2 ulPlayReplySeqNum)
+RTSPClientProtocol::trimRequestPendingReplyList(CHXSimpleLi
st& requestPendingReplyList,
+ UINT32 ulReplySeqNum,
+ UINT32* pNumRepliesTrimmed)
{
UINT32* pHeadCmdSeqNum;
HXBOOL bIsResumeReply = FALSE;
+ UINT32 ulNumRepliesTrimmed = 0;
- while (!m_ResumeRequestPendingReplyList.IsEmpty())
+ while (!requestPendingReplyList.IsEmpty())
{
- pHeadCmdSeqNum = (UINT32*)
m_ResumeRequestPendingReplyList.GetHead();
- if ((ulPlayReplySeqNum - (*pHeadCmdSeqNum)) >= 0)
+ pHeadCmdSeqNum = (UINT32*)
requestPendingReplyList.GetHead();
+ if (((INT32) (ulReplySeqNum - (*pHeadCmdSeqNum))) >= 0)
{
- if ((*pHeadCmdSeqNum) == ulPlayReplySeqNum)
+ if ((*pHeadCmdSeqNum) == ulReplySeqNum)
{
bIsResumeReply = TRUE;
}
- m_ResumeRequestPendingReplyList.RemoveHead();
+ requestPendingReplyList.RemoveHead();
+ ulNumRepliesTrimmed++;
delete pHeadCmdSeqNum;
}
else
 -8831,11
+8882,17 
}
}
+ if (pNumRepliesTrimmed)
+ {
+ *pNumRepliesTrimmed = ulNumRepliesTrimmed;
+ }
+
return bIsResumeReply;
}
HX_RESULT
-RTSPClientProtocol::augmentResumeRequestPendingReplyList(UI
NT32 ulPlayReplySeqNum)
+RTSPClientProtocol::augmentRequestPendingReplyList(CHXSimpl
eList& requestPendingReplyList,
+ UINT32 ulReplySeqNum)
{
UINT32* pTailCmdSeqNum = new UINT32;
HX_RESULT retVal = HXR_OUTOFMEMORY;
 -8843,8
+8900,8 
if (pTailCmdSeqNum)
{
retVal = HXR_OK;
- *pTailCmdSeqNum = ulPlayReplySeqNum;
- m_ResumeRequestPendingReplyList.AddTail((void*)
pTailCmdSeqNum);
+ *pTailCmdSeqNum = ulReplySeqNum;
+ requestPendingReplyList.AddTail((void*) pTailCmdSeqNum);
}
return retVal;
Index: rtsp/pub/rtspclnt.h
============================================================
=======
RCS file: /cvsroot/protocol/rtsp/pub/rtspclnt.h,v
retrieving revision 1.88
diff -u -w -r1.88 rtspclnt.h
--- rtsp/pub/rtspclnt.h 14 Nov 2006 21:25:17 -0000 1.88
+++ rtsp/pub/rtspclnt.h 16 Nov 2006 21:34:31 -0000
 -1033,9
+1033,12 
void clearTransportRequestList ();
void clearStreamInfoList ();
void clearUDPResponseHelperList ();
- void clearResumeRequestPendingReplyList();
- HXBOOL trimResumeRequestPendingReplyList(UINT32
ulReplySeqNum);
- HX_RESULT augmentResumeRequestPendingReplyList(UINT32
ulReplySeqNum);
+ void clearRequestPendingReplyList(CHXSimpleList&
requestPendingReplyList);
+ HXBOOL trimRequestPendingReplyList(CHXSimpleList&
requestPendingReplyList,
+ UINT32 ulReplySeqNum,
+ UINT32* pNumRepliesTrimmed = NULL);
+ HX_RESULT
augmentRequestPendingReplyList(CHXSimpleList&
requestPendingReplyList,
+ UINT32 ulReplySeqNum);
void clearSocketStreamMap(CHXMapLongToObj*&
pSocketStreamMap);
HX_RESULT getStreamDescriptionMimeType (char*&
pMimeType);
IHXStreamDescription*
 -1225,6
+1228,7 
CHXSimpleList
m_UDPResponseHelperList;
CHXSimpleList m_sessionList;
CHXSimpleList m_ResumeRequestPendingReplyList;
+ CHXSimpleList m_PlayRequestPendingReplyList;
CHXMapLongToObj*
m_pTransportStreamMap; // map streamID->trans
CHXMapLongToObj*
m_pTransportPortMap; // map port->trans
CHXMapLongToObj*
m_pTransportMPortMap; // map multicast port->trans
Index: transport/common/system/rtsptran.cpp
============================================================
=======
RCS file:
/cvsroot/protocol/transport/common/system/rtsptran.cpp,v
retrieving revision 1.51
diff -u -w -r1.51 rtsptran.cpp
--- transport/common/system/rtsptran.cpp 14 Nov 2006
21:25:17 -0000 1.51
+++ transport/common/system/rtsptran.cpp 16 Nov 2006
21:34:31 -0000
 -560,7
+560,7 
void
RTSPTransport::setFirstTimeStamp(UINT16 uStreamNumber,
UINT32 ulTS,
- HXBOOL bIsRaw)
+ HXBOOL bIsRaw, HXBOOL
bOnPauseResume)
{
RTSPStreamData* pStreamData =
m_pStreamHandler->getStreamData(uStreamNumber);
 -612,6
+612,11 
// request
m_ulPlayRangeFrom = ulFrom;
m_ulPlayRangeTo = ulTo;
+
+ HXLOGL3(HXLOG_RTSP,
"RTSPTransport[%p]::setPlayRange(From=%lu,
To=%lu)",
+ this,
+ m_ulPlayRangeFrom,
+ m_ulPlayRangeTo);
}
void
 -708,17
+713,9 
/*
* This is a lost packet
*/
-
- result =
m_pCommonClassFactory->CreateInstance(CLSID_IHXPacket,
-
(void**)&pPacket);
-
- if (result != HXR_OK)
- {
- return result;
- }
-
UINT8 unASMFlags = 0;
UINT32 ulTime = 0;
+
if (clientPacket->IsDroppedPacket())
{
// Preserve dropped flag as an ASM flag.
 -732,7
+729,40 
ulTime = clientPacket->GetTime();
}
+ if (pStreamData->m_bUsesRTPPackets)
+ {
+ IHXRTPPacket* pRTPPacket = NULL;
+
+ result =
m_pCommonClassFactory->CreateInstance(CLSID_IHXRTPPacket,
+ (void**)&pRTPPacket);
+
+ if (result != HXR_OK)
+ {
+ return result;
+ }
+
+ pRTPPacket->SetRTP(0,
+ ulTime,
+ 0, // We do not set RTP time-stamp for lost
packet
+ uStreamNumber,
+ unASMFlags,
+ 0);
+
+ pPacket = (IHXPacket*) pRTPPacket;
+ }
+ else
+ {
+ result =
m_pCommonClassFactory->CreateInstance(CLSID_IHXPacket,
+ (void**)&pPacket);
+
+ if (result != HXR_OK)
+ {
+ return result;
+ }
+
pPacket->Set(0, ulTime, uStreamNumber, unASMFlags, 0);
+ }
+
pPacket->SetAsLost();
}
else if (pStreamData->m_bUsesRTPPackets)
Index: transport/common/system/pub/rtsptran.h
============================================================
=======
RCS file:
/cvsroot/protocol/transport/common/system/pub/rtsptran.h,v
retrieving revision 1.42
diff -u -w -r1.42 rtsptran.h
--- transport/common/system/pub/rtsptran.h 14 Nov 2006
21:25:17 -0000 1.42
+++ transport/common/system/pub/rtsptran.h 16 Nov 2006
21:34:31 -0000
 -290,7
+290,8 
HXBOOL bOnPauseResume = FALSE);
UINT32 getFirstTimestamp (UINT16
streamNumber);
virtual void setFirstTimeStamp (UINT16
uStreamNumber, UINT32 ulTS,
- HXBOOL bIsRaw =
FALSE);
+ HXBOOL bIsRaw =
FALSE,
+ HXBOOL bOnPauseResume = FALSE);
// only in RTPTransport...
virtual void notifyRTPInfoProcessed (HXBOOL
bOnPauseResume = FALSE) {}
Index: transport/rtp/rtptran.cpp
============================================================
=======
RCS file: /cvsroot/protocol/transport/rtp/rtptran.cpp,v
retrieving revision 1.106
diff -u -w -r1.106 rtptran.cpp
--- transport/rtp/rtptran.cpp 14 Nov 2006 21:25:17
-0000 1.106
+++ transport/rtp/rtptran.cpp 16 Nov 2006 21:34:32 -0000
 -283,7
+283,7 
{
m_bDone = TRUE;
- HXLOGL3(HXLOG_RTSP, "RTPBaseTransport[%p]: one()&qu
ot;,this);
+ HXLOGL3(HXLOG_RTSP, "RTPBaseTransport[%p]: one()
Strm=%u", this, m_streamNumber);
HX_RELEASE(m_pQoSInfo);
HX_RELEASE(m_pBwMgrInput);
HX_RELEASE(m_pRTCPTran);
 -360,7
+360,10 
void
RTPBaseTransport::addStreamInfo(RTSPStreamInfo*
pStreamInfo, UINT32 ulBufferDepth)
{
- HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::addStreamInfo(): str %lu; buffer
depth = %lu",this, pStreamInfo->m_streamNumber,
ulBufferDepth);
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::addStreamInfo(): Strm=%u;
BufferDepth=%lu",
+ this,
+ pStreamInfo->m_streamNumber,
+ ulBufferDepth);
RTSPTransport::addStreamInfo(pStreamInfo,
ulBufferDepth);
// there better be only one stream
 -461,11
+464,16 
HX_RESULT
RTPBaseTransport::setFirstSeqNum(UINT16 uStreamNumber,
UINT16 uSeqNum, HXBOOL bOnPauseResume)
{
- HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setFirstSeqNum(); str %u first
seq = %u",this, uStreamNumber, uSeqNum);
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setFirstSeqNum(); Strm=%u
SeqNum=%u OnPauseResume=%c",
+ this,
+ uStreamNumber,
+ uSeqNum,
+ bOnPauseResume ? 'T' : 'F');
HX_RESULT theErr = HXR_UNEXPECTED;
// On client we allow setting of sequence number only
once not to cause
// havoc in transport buffer
+
if (m_bIsSource || (!m_bSeqNoSet))
{
theErr =
RTSPTransport::setFirstSeqNum(uStreamNumber, uSeqNum,
bOnPauseResume);
 -475,9
+483,9 
uSeqNum);
#endif // RTP_MESSAGE_DEBUG
- // In the client, we set for start of stream only if thee
are no more
- // pipelined seeks outstanding.
- if (m_bIsSource || (m_ulSeekCount <= 1))
+ // In the client, we set for start of stream only if there
are no more
+ // pipelined seeks outstanding an this is not a resume
request.
+ if (m_bIsSource || ((!bOnPauseResume) &&
(m_ulSeekCount <= 1)))
{
if (SUCCEEDED(theErr))
{
 -566,9
+574,14 
void
RTPBaseTransport::setFirstTimeStamp(UINT16 uStreamNumber,
UINT32 ulTS,
- HXBOOL bIsRaw)
+ HXBOOL bIsRaw, HXBOOL
bOnPauseResume)
{
- HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setFirstTimeStamp(); str %u
first ts = %lu",this, uStreamNumber, ulTS);
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setFirstTimeStamp() Strm=%u
TS=%lu IsRaw=%c OnPauseResume=%c",
+ this,
+ uStreamNumber,
+ ulTS,
+ bIsRaw ? 'T' : 'F',
+ bOnPauseResume ? 'T' : 'F');
RTSPStreamData* pStreamData =
m_pStreamHandler->getStreamData(uStreamNumber);
 -588,10
+601,11 
}
else if (!m_bRTPTimeSet)
{
- // If there are outstanding pipelined seeks, we do not
set
+ // If there are outstanding pipelined seeks or this is
just a
+ // resumption action, we do not set
// the start time as we wait for the information
provided by
// the last pipelined seek.
- if (m_ulSeekCount > 1)
+ if (bOnPauseResume || (m_ulSeekCount > 1))
{
return;
}
 -627,6
+641,12 
STREAM_END_DELAY_RTP_TOLERANCE);
}
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setFirstTimeStamp() INIT:
Strm=%u RTPOffset=%lu HXOffset=%lu",
+ this,
+ uStreamNumber,
+ m_lTimeOffsetRTP,
+ m_lTimeOffsetHX);
+
#ifdef RTP_MESSAGE_DEBUG
messageFormatDebugFileOut("INIT:
RTPOffset=%u HXOffset=%u",
m_lTimeOffsetRTP,
 -644,9
+664,10 
void
RTPBaseTransport::notifyRTPInfoProcessed(HXBOOL
bOnPauseResume)
{
- HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::notifyRTPInfoProcessed(OnPauseRe
sume=%c) OutstandingSeekCount=%lu",
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::notifyRTPInfoProcessed(OnPauseRe
sume=%c) Strm=%u OutstandingSeekCount=%lu",
this,
bOnPauseResume ? 'T' : 'F',
+ m_streamNumber,
m_ulSeekCount);
// This method is invoked to indicate that RTP-Info has
been processed
 -703,6
+724,13 
// pipelined seek.
m_ulSeekCount++;
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::setPlayRange(From=%lu To=%lu)
SeekStarted: Strm=%u SeekCount=%lu",
+ this,
+ ulFrom,
+ ulTo,
+ m_streamNumber,
+ m_ulSeekCount);
+
#ifdef RTP_MESSAGE_DEBUG
messageFormatDebugFileOut("INIT:
PlayRange=%u-%u",
ulFrom, ulTo);
 -1620,7
+1648,7 
sequence number (contiguous) since some servers
send lossy streams
in the beginning. */
if (m_bSeqNoSet ||
- ((m_bRTPTimeSet || m_bAbortWaitForStartInfo)
&&
+ (m_bAbortWaitForStartInfo &&
((!m_bIsLive) ||
(m_StartInfoWaitQueue.GetCount() >=
MIN_NUM_PACKETS_SCANNED_FOR_LIVE_START))))
{
IHXBuffer* pStoredBuffer;
 -1674,6
+1702,10 
messageFormatDebugFileOut("INIT: StartSeqNum
not in RTP-Info");
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::_handlePacket() StartSeqNum not
in RTP-Info for Strm=%u",
+ this,
+ m_streamNumber);
+
setFirstSeqNum(m_streamNumber, m_uFirstSeqNum);
}
if (!m_bRTPTimeSet)
 -1687,6
+1719,10 
messageFormatDebugFileOut("INIT: RTPOffset not
in RTP-Info");
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::_handlePacket() RTPOffset not in
RTP-Info for Strm=%u",
+ this,
+ m_streamNumber);
+
setFirstTimeStamp(m_streamNumber, m_ulFirstRTPTS);
m_bWeakStartSync = TRUE;
}
 -1743,6
+1779,14 
}
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::_handlePacket() PKT(Strm=%u):
(Seq=%6u,RTPTime=%10u) ->
(HXTimeval=%10u,RTPTimeval=%10u)",
+ this,
+ m_streamNumber,
+ ((UINT16) pkt.seq_no),
+ pkt.timestamp,
+ timeStampHX,
+ timeStampRTP);
+
pStreamData->m_bFirstPacket = FALSE;
CHXPacket* pPacket = new CHXRTPPacket;
 -1822,9
+1866,13 
m_pStreamHandler->getStreamData(m_streamNumber);
#ifdef RTP_MESSAGE_DEBUG
- messageFormatDebugFileOut("RTCP-SYNC: Received
NTPTime=%u RTPTime=%u",
+ messageFormatDebugFileOut("RTCP-SYNC: Received
NTPTime=%lu RTPTime=%lu",
ulNtpHX, ulRTPTime);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::handleRTCPSync()
RTCP-SYNC(Strm=%u): Received NTPTime=%lu RTPTime=%lu",
+ this,
+ m_streamNumber,
+ ulNtpHX, ulRTPTime);
// We ignore the RTCP sync until we can compute npt
(m_bRTPTimeSet) or
// if the RTCP packet contains no synchronization
information
 -1855,9
+1903,14 
if (m_bIsSyncMaster &&
m_pSyncServer)
{
#ifdef RTP_MESSAGE_DEBUG
-
messageFormatDebugFileOut("RTCP-SYNC: Distribute Master
Sync NPTTime=%u SyncOffset=%d",
+
messageFormatDebugFileOut("RTCP-SYNC: Distribute Master
Sync NPTTime=%lu SyncOffset=%ld",
ulHXTime,
-lSyncOffsetHX);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::handleRTCPSync()
RTCP-SYNC(Strm=%u): Distribute Master Sync NPTTime=%lu
SyncOffset=%ld",
+ this,
+ m_streamNumber,
+ ulHXTime, -lSyncOffsetHX);
+
m_pSyncServer->DistributeSync(ulHXTime, -lSyncOffsetHX);
}
else
 -1874,9
+1927,13 
(pStreamData->m_pTSConverter->hxa2rtp_raw((ULONG32)
(-lSyncOffsetHX)));
}
#ifdef RTP_MESSAGE_DEBUG
-
messageFormatDebugFileOut("RTCP-SYNC: Self-Sync
SyncOffset=%d SyncOffsetRTP=%d",
+
messageFormatDebugFileOut("RTCP-SYNC: Self-Sync
SyncOffset=%ld SyncOffsetRTP=%ld",
m_lSyncOffsetHX, m_lSyncOffsetRTP);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::handleRTCPSync()
RTCP-SYNC(Strm=%u): Self-Sync SyncOffset=%ld
SyncOffsetRTP=%ld",
+ this,
+ m_streamNumber,
+ m_lSyncOffsetHX, m_lSyncOffsetRTP);
}
}
}
 -1889,6
+1946,11 
messageFormatDebugFileOut("RTCP-SYNC: Distribute
NTP-NPT Mapping NTPTime=%u NPTTime=%u",
ulNtpHX,
ulHXTime);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::handleRTCPSync()
RTCP-SYNC(Strm=%u): Distribute NTP-NPT Mapping NTPTime=%u
NPTTime=%u",
+ this,
+ m_streamNumber,
+ ulNtpHX, ulHXTime);
+
m_pSyncServer->DistributeSyncAnchor(ulHXTime, ulNtpHX);
}
}
 -1910,6
+1972,10 
messageFormatDebugFileOut("RTCP-SYNC: Received
NTP-NPT Mapping NTPTime=%u NPTTime=%u
NTPtoNPTOffset=%d",
ulNTPTime, ulHXTime,
m_lNTPtoHXOffset);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::anchorSync() RTCP-SYNC(Strm=%u):
Received NTP-NPT Mapping NTPTime=%u NPTTime=%u
NTPtoNPTOffset=%d",
+ this,
+ m_streamNumber,
+ ulNTPTime, ulHXTime, m_lNTPtoHXOffset);
return retVal;
}
 -1941,6
+2007,10 
messageFormatDebugFileOut("RTCP-SYNC:
Master-Sync NPTTime=%u MasterSyncOffset=%d
MasterSyncOffsetRTP=%d",
ulHXTime,
m_lOffsetToMasterHX, m_lOffsetToMasterRTP);
#endif // RTP_MESSAGE_DEBUG
+ HXLOGL4(HXLOG_RTSP,
"RTPBaseTransport[%p]::handleMasterSync()
RTCP-SYNC(Strm=%u): Master-Sync NPTTime=%u
MasterSyncOffset=%d MasterSyncOffsetRTP=%d",
+ this,
+ m_streamNumber,
+ ulHXTime, m_lOffsetToMasterHX, m_lOffsetToMasterRTP);
}
return retVal;
 -1966,7
+2036,11 
UINT32 uReasonCode /* = 0 */,
const char* pReasonText /* =
NULL */)
{
- HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::streamDone(); str %u; reason
%lu",this, streamNumber, uReasonCode);
+ HXLOGL3(HXLOG_RTSP,
"RTPBaseTransport[%p]::streamDone() Strm=%u
ReasonCode=%lu ReasonText=%s",
+ this,
+ streamNumber,
+ uReasonCode,
+ pReasonText ? pReasonText : "NULL");
HX_ASSERT(m_streamNumber == streamNumber);
HX_ASSERT(m_streamNumber ==
m_pRTCPTran->m_streamNumber);
 -4214,7
+4288,11 
UINT32 uReasonCode /* = 0 */,
const char* pReasonText /* =
NULL */)
{
- HXLOGL3(HXLOG_RTSP,
"RTCPUDPTransport[%p]::streamDone(): str = %u; reason =
%lu",this, streamNumber, uReasonCode);
+ HXLOGL3(HXLOG_RTSP,
"RTCPUDPTransport[%p]::streamDone() Strm=%u
ReasonCode=%lu ReasonText=%s",
+ this,
+ streamNumber,
+ uReasonCode,
+ pReasonText ? pReasonText : "NULL");
HX_ASSERT(streamNumber == m_streamNumber);
HX_ASSERT(streamNumber ==
m_pDataTransport->m_streamNumber);
Index: transport/rtp/pub/rtptran.h
============================================================
=======
RCS file: /cvsroot/protocol/transport/rtp/pub/rtptran.h,v
retrieving revision 1.53
diff -u -w -r1.53 rtptran.h
--- transport/rtp/pub/rtptran.h 14 Nov 2006 21:25:17
-0000 1.53
+++ transport/rtp/pub/rtptran.h 16 Nov 2006 21:34:32 -0000
 -180,7
+180,8 
HX_RESULT setFirstSeqNum (UINT16
streamNumber, UINT16 seqNum, HXBOOL bOnPauseResume = FALSE);
void notifyRTPInfoProcessed (HXBOOL bOnPauseResume =
FALSE);
void setFirstTimeStamp (UINT16
uStreamNumber, UINT32 ulTS,
- HXBOOL bIsRaw =
FALSE);
+ HXBOOL bIsRaw =
FALSE,
+ HXBOOL bOnPauseResume = FALSE);
void SetFirstTSLive (RTSPStreamData*
pStreamData, UINT32 ulTS, HXBOOL bIsRaw);
void SetFirstTSStatic (RTSPStreamData*
pStreamData, UINT32 ulTS, HXBOOL bIsRaw);
Index: vidrend.cpp
============================================================
=======
RCS file: /cvsroot/datatype/common/vidrend/vidrend.cpp,v
retrieving revision 1.88
diff -u -w -r1.88 vidrend.cpp
--- vidrend.cpp 21 Oct 2006 02:09:16 -0000 1.88
+++ vidrend.cpp 16 Nov 2006 21:42:30 -0000
 -1071,6
+1071,13 
//
STDMETHODIMP CVideoRenderer::OnPacket(IHXPacket* pPacket,
LONG32 lTimeOffset)
{
+ // Ignore any packet delivered during the seek state
since they are
+ // pre-seek packets and thus out of context for video
playback.
+ if (m_PlayState == Seeking)
+ {
+ return HXR_OK;
+ }
+
HXLOGL4(HXLOG_BVID, "CVideoRenderer::OnPacket()
pts=%lu offset=%ld rule=%u flags=0x%02x timenow=%lu
decqdepth=%lu",
(pPacket ? pPacket->GetTime() : 0),
lTimeOffset,
 -1130,10
+1137,6 
m_pTimeSyncSmoother->SetBaseTimeFlag();
}
- // If we are seeking, this is a pre-seek packet and
there is
- // no need to decode it
- if (m_PlayState != Seeking)
- {
#ifdef HELIX_FEATURE_VIDREND_THREADEDDECODE_ON_STARTUP
if (IsDecoderRunning() &&
m_pDecoderPump)
{
 -1153,7
+1156,6 
}
}
}
- }
HXLOGL4(HXLOG_BVID, "CVideoRenderer::OnPacket()
Exiting timenow=%lu decqdepth=%lu",
m_pTimeSyncSmoother->GetTimeNow(),
Index: payload/mp4vpyld.cpp
============================================================
=======
RCS file: /cvsroot/datatype/mp4/payload/mp4vpyld.cpp,v
retrieving revision 1.18
diff -u -w -r1.18 mp4vpyld.cpp
--- payload/mp4vpyld.cpp 28 Oct 2005 11:01:37 -0000 1.18
+++ payload/mp4vpyld.cpp 16 Nov 2006 21:43:41 -0000
 -592,16
+592,18 
HX_RELEASE(pRTPPacket);
- if (!m_bUsesRTPPackets)
+ if (m_bUsesRTPPackets)
{
- m_ulSamplesPerSecond = 1000; // RDT time stamp
- }
-
HX_ASSERT(m_ulSamplesPerSecond != 0);
m_TSConverter.SetBase(m_ulSamplesPerSecond,
1000);
}
+ else
+ {
+ m_TSConverter.SetBase(1000, 1000);
+ }
+ }
// Add this packet to our list of input packets
pPacket->AddRef();
 -1083,6
+1085,7 
ULONG32 ulValidSegmentCount = 0;
IHXPacket* pPacket;
IHXBuffer* pBuffer = NULL;
+ LISTPOSITION tentativeListPos;
LISTPOSITION listPos;
ULONG32 ulIdx;
HXBOOL bIsLost;
 -1098,7
+1101,7 
do
{
listPos = m_InputPackets.GetHeadPosition();
- if( listPos == NULL )
+ if (tentativeListPos == NULL)
{
return HXR_OUTOFMEMORY;
}
 -1116,7
+1119,11 
ulValidSegmentCount =
CountValidPackets(NUM_OVERLAP_SEGMENTS);
}
- pPacket = (IHXPacket*) m_InputPackets.GetNext(listPos);
+ // Get Next below will advance the list position.
+ // Consider this list position tentative until we decided
+ // to include that list element into the current frame.
+ tentativeListPos = listPos;
+ pPacket = (IHXPacket*)
m_InputPackets.GetNext(tentativeListPos);
if (!pPacket->IsLost())
{
 -1153,6
+1160,9 
}
ulSegmentCount++;
+ // Since we are including the current packet into the
frame,
+ // make the tentative list position permanent.
+ listPos = tentativeListPos;
} while ((pPacket->GetASMRuleNumber() != 1)
&& (listPos != NULL));
m_ulFrameCount--;
_______________________________________________
Protocol-dev mailing list
Protocol-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/pr
otocol-dev
|