[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-server-cvs
Subject: [Server-cvs] engine/inputsource Umakefil, 1.11.8.1,
From: jzeng () helixcommunity ! org
Date: 2008-03-28 4:31:45
Message-ID: 200803280431.m2S4Vtcr017488 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/server/engine/inputsource
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv3303/engine/inputsource
Modified Files:
Tag: SERVER_12_0
Umakefil base_shim.cpp mdpshim.cpp ppmstaticshim.cpp
Log Message:
Synopsis
========
Fix realmedia fcs bugs.
Branches: HEAD, server12, server_12_0
Suggested Reviewer: Jamie
Description
===========
RV mutiple frames packets have internal timestamp, and we need to
modify them for fcs just as slta does. There is a class
CRVPacketTimeOffsetHandler to do that, but I choose to copy a few
lines over because:
1. that class uses async method of HandlePacket-PacketReady to pass
packets, which will require a major change in baseshim.
2. that class is extremely inefficient unless we rewrite it. It does
at least 4 strcasecmp for each packets.
In addition, I also add a variable to decide to switch stream. We
can't switch at any switch_off packets: we need to switch at the video
stream. But The method I used still not work right for multi-rate 3gp
content, and I will address that later.
By the way, I couldn't bear the code in baseshim anymore, so I
refactor it a little bit.
Remaing problems:
1. Now we can switch and the player won't complain anymore. For q=1
switch the playbacks look okay, but for q=0 the player may rebuffer
and resume playback in a few seconds.
2. The above-mentioned 3gp multi-rate issue.
Files Affected
==============
server/common/util/livekeyframe.cpp,v
server/common/util/pub/livekeyframe.h,v
server/engine/inputsource/Umakefil,v
server/engine/inputsource/base_shim.cpp,v
server/engine/inputsource/mdpshim.cpp,v
server/engine/inputsource/ppmstaticshim.cpp,v
server/engine/inputsource/pub/base_shim.h,v
server/engine/inputsource/pub/mdpshim.h,v
server/engine/inputsource/pub/ppmstaticshim.h,v
server/engine/session/clientsession.cpp,v
server/engine/session/pub/clientsession.h,v
server-restricted/engine/bin/make_retail,v
Testing Performed
=================
Unit Tests:
None.
Integration Tests:
Test realmedia switching
Verify 3gp switching still okay.
Leak Tests:
--lct 1:1:1 shows no leaks.
Performance Tests:
- None
Platforms Tested: linux-rhel4-i686
Build verified: linux-rhel4-i686
Index: ppmstaticshim.cpp
===================================================================
RCS file: /cvsroot/server/engine/inputsource/ppmstaticshim.cpp,v
retrieving revision 1.14.2.11.2.1
retrieving revision 1.14.2.11.2.2
diff -u -d -r1.14.2.11.2.1 -r1.14.2.11.2.2
--- ppmstaticshim.cpp 25 Mar 2008 17:51:00 -0000 1.14.2.11.2.1
+++ ppmstaticshim.cpp 28 Mar 2008 04:31:42 -0000 1.14.2.11.2.2
@@ -62,9 +62,14 @@
#include "ratedescmgr.h"
-CPPMStaticShim::CPPMStaticShim(IHXPSourcePackets* pSourcePackets, IHXSwitchResponse* \
pResp, IHXCommonClassFactory* pCCF,
- ClientSession::StreamInfo** ppStrmInfo, UINT16 num_streams, \
HXBOOL bIsRTP)
- :BasePacketShim(pResp,pCCF,ppStrmInfo,num_streams)
+CPPMStaticShim::CPPMStaticShim(IHXRegistry* pReg,
+ IHXPSourcePackets* pSourcePackets,
+ IHXSwitchResponse* pResp,
+ IHXCommonClassFactory* pCCF,
+ ClientSession::StreamInfo** ppStrmInfo,
+ UINT16 num_streams,
+ HXBOOL bIsRTP)
+ :BasePacketShim(pReg, pResp,pCCF,ppStrmInfo,num_streams)
,m_pPacketSource(pSourcePackets)
,m_pPacketSink(NULL)
,m_pSwitchPacketSource(NULL)
@@ -175,6 +180,7 @@
m_bWirePayload = FALSE;
IHXPacketPayloadType* pPacketPayloadType = NULL;
+
if (SUCCEEDED(m_pPacketSource->QueryInterface(IID_IHXPacketPayloadType,
(void**)&pPacketPayloadType)))
{
Index: base_shim.cpp
===================================================================
RCS file: /cvsroot/server/engine/inputsource/base_shim.cpp,v
retrieving revision 1.1.2.8.2.2
retrieving revision 1.1.2.8.2.3
diff -u -d -r1.1.2.8.2.2 -r1.1.2.8.2.3
--- base_shim.cpp 25 Mar 2008 17:51:00 -0000 1.1.2.8.2.2
+++ base_shim.cpp 28 Mar 2008 04:31:42 -0000 1.1.2.8.2.3
@@ -48,6 +48,7 @@
#include "hxsbuffer.h"
#include "hxmarsh.h"
#include "tconverter.h"
+#include "tsfixup.h"
#include "hxqos.h"
#include "hxqosinfo.h"
@@ -61,15 +62,21 @@
#include "uberstreammgr.h"
#include "streamselector.h"
#include "ratedescmgr.h"
+#include "livekeyframe.h"
-BasePacketShim::BasePacketShim(IHXSwitchResponse* pResp, IHXCommonClassFactory* \
pCCF,
- ClientSession::StreamInfo** ppStrmInfo, UINT16 num_streams)
+BasePacketShim::BasePacketShim(IHXRegistry* pReg,
+ IHXSwitchResponse* pResp,
+ IHXCommonClassFactory* pCCF,
+ ClientSession::StreamInfo** ppStrmInfo,
+ UINT16 num_streams)
:m_ulRefCount(0)
,m_pSwitchResponse(pResp)
,m_bSwitch(FALSE)
,m_bSwitchSource(FALSE)
,m_uNumOfStreams(num_streams)
+ ,m_ulRVStream(0xFFFFFFFF)
+ ,m_ulSwitchStream(0xFFFFFFFF)
{
if (pCCF)
{
@@ -99,8 +106,60 @@
CHXTimestampConverter(CHXTimestampConverter::SAMPLES,
ppStrmInfo[i]->m_sampleRate);
}
+
+ IHXBuffer* pMime = NULL;
+ IHXValues* pHeader = ppStrmInfo[i]->m_pActualHeader;
+ UINT32 ulValue = 0;
+ HX_RESULT hResult = HXR_FAIL;
+
+ if(!pHeader)
+ {
+ continue;
+ }
+
+ hResult = pHeader->GetPropertyCString("MimeType", pMime);
+ if(FAILED(hResult))
+ {
+ continue;
+ }
+
+ //XXXJJ here we use the rsd utility to determine a video stream. We will \
revisit later + //if we find out that we need to include more mime type.
+ //This still can't handle multi-rate 3gp content. I will address that \
later. + if(IsVideoKeyframeStream(pReg, (const char*)pMime->GetBuffer()))
+ {
+ pHeader->GetPropertyULONG32("StreamNumber", m_ulSwitchStream);
+ }
+
+ hResult = pHeader->GetPropertyULONG32("HasRelativeTS", ulValue);
+
+ if(SUCCEEDED(hResult) && ulValue != 0)
+ {
+ HX_RELEASE(pMime);
+ continue;
+ }
+ else if(IsRealVideoStream((const char*)pMime->GetBuffer()))
+ {
+ pHeader->GetPropertyULONG32("StreamNumber", m_ulRVStream);
+ }
+ HX_RELEASE(pMime);
+
}
+ if(m_ulSwitchStream == 0xFFFFFFFF)
+ {
+ if(num_streams == 1 && ppStrmInfo[0] && ppStrmInfo[0]->m_pActualHeader)
+ {
+ ppStrmInfo[0]->m_pActualHeader->GetPropertyULONG32("StreamNumber", \
m_ulSwitchStream); + }
+ }
+
+ if(m_ulSwitchStream == 0xFFFFFFFF)
+ {
+ //still not got it, just set it to 0
+ HX_ASSERT(FALSE);
+ m_ulSwitchStream = 0;
+ }
}
BasePacketShim::~BasePacketShim()
@@ -191,19 +250,15 @@
{
return NULL;
}
- if (m_pStreamInfo[m_packet->unStreamNumber].uNewclip)
+
+ StreamData* pStreamInfo = m_pStreamInfo + m_packet->unStreamNumber;
+ if (pStreamInfo->uNewclip)
{
- m_pStreamInfo[m_packet->unStreamNumber].uDiff +=
- (m_pStreamInfo[m_packet->unStreamNumber].ulLastPacketTS
- - m_packet->ulCurTS
- + m_pStreamInfo[m_packet->unStreamNumber].uPacketDiff);
+ pStreamInfo->uDiff += (pStreamInfo->ulLastPacketTS - m_packet->ulCurTS + \
pStreamInfo->uPacketDiff);
- m_pStreamInfo[m_packet->unStreamNumber].uRTPDiff +=
- (m_pStreamInfo[m_packet->unStreamNumber].ulRTPLastPacketTS
- -m_packet->ulRTPCurTS
- + m_pStreamInfo[m_packet->unStreamNumber].uRTPPacketDiff);
+ pStreamInfo->uRTPDiff += (pStreamInfo->ulRTPLastPacketTS \
-m_packet->ulRTPCurTS + pStreamInfo->uRTPPacketDiff);
- m_pStreamInfo[m_packet->unStreamNumber].uNewclip = 0;
+ pStreamInfo->uNewclip = 0;
}
else
{
@@ -212,17 +267,17 @@
timestamp difference between 2 consecutive packets of the old clips
so that the 1st packet of the new clip will differ by the same from
the last packet of the old clip */
- m_pStreamInfo[m_packet->unStreamNumber].uPacketDiff
- = (m_packet->ulCurTS - \
m_pStreamInfo[m_packet->unStreamNumber].ulLastPacketTS); + \
pStreamInfo->uPacketDiff = m_packet->ulCurTS - pStreamInfo->ulLastPacketTS;
- m_pStreamInfo[m_packet->unStreamNumber].uRTPPacketDiff
- = (m_packet->ulRTPCurTS - \
m_pStreamInfo[m_packet->unStreamNumber].ulRTPLastPacketTS); + \
pStreamInfo->uRTPPacketDiff = m_packet->ulRTPCurTS - pStreamInfo->ulRTPLastPacketTS; \
}
- m_bSwitchSource = (m_bSwitch == TRUE && (pPacket->GetASMFlags() & \
HX_ASM_SWITCH_OFF)); + m_bSwitchSource = m_bSwitch == TRUE &&
+ m_packet->unStreamNumber == m_ulSwitchStream &&
+ (pPacket->GetASMFlags() & HX_ASM_SWITCH_OFF);
- m_pStreamInfo[m_packet->unStreamNumber].ulLastPacketTS = m_packet->ulCurTS;
- m_pStreamInfo[m_packet->unStreamNumber].ulRTPLastPacketTS = \
m_packet->ulRTPCurTS; + pStreamInfo->ulLastPacketTS = m_packet->ulCurTS;
+ pStreamInfo->ulRTPLastPacketTS = m_packet->ulRTPCurTS;
ServerRTPPacket* pRTPNewPacket = new ServerRTPPacket(TRUE);
pPacket->QueryInterface(IID_IHXRTPPacket,(void**)&pRTPPacket);
@@ -234,12 +289,61 @@
{
((ServerPacket*)pRTPNewPacket)->SetData((ServerPacket*)pPacket);
}
- pRTPNewPacket->SetRTP(pBuffer, m_packet->ulCurTS + \
m_pStreamInfo[m_packet->unStreamNumber].uDiff,
- m_packet->ulRTPCurTS + \
m_pStreamInfo[m_packet->unStreamNumber].uRTPDiff, +
+ //XXXJJ realvideo has internal timestamp inside the payload, so we need to
+ //modify it too.
+ if(m_packet->unStreamNumber == m_ulRVStream && pStreamInfo->uDiff)
+ {
+ AdjustPayloadTimeStamp(pBuffer, m_packet->ulCurTS, pStreamInfo->uDiff);
+ }
+ else
+ {
+ pBuffer->AddRef();
+ }
+
+ pRTPNewPacket->SetRTP(pBuffer, m_packet->ulCurTS + pStreamInfo->uDiff,
+ m_packet->ulRTPCurTS + pStreamInfo->uRTPDiff,
m_packet->unStreamNumber, m_packet->unASMFlags, \
m_packet->unASMRuleNumber);
- pRTPNewPacket->SetMediaTimeInMs(m_packet->ulCurTS + \
m_pStreamInfo[m_packet->unStreamNumber].uDiff); + pBuffer->Release();
+
+ pRTPNewPacket->SetMediaTimeInMs(m_packet->ulCurTS + pStreamInfo->uDiff);
HX_DELETE(m_packet);
HX_RELEASE(pRTPPacket);
return pRTPNewPacket;
}
+
+void BasePacketShim::AdjustPayloadTimeStamp(IHXBuffer*& pBuffer, UINT32 ulTime, \
UINT32 ulTimeOffset) +{
+ UINT32 ulBufferSize = 0;
+ UCHAR* pBufferData = NULL;
+ IHXBuffer* pNewBuffer = NULL;
+
+ pBuffer->Get(pBufferData, ulBufferSize);
+
+ if (HasInternalTimestamps(pBufferData, ulBufferSize))
+ {
+ m_pCCF->CreateInstance(CLSID_IHXBuffer, (void**)&pNewBuffer);
+ pNewBuffer->SetSize(ulBufferSize * 2);
+ BYTE* pTemporaryBuffer = pNewBuffer->GetBuffer();
+ UINT32 ulOutputSize = 0;
+
+ OffsetInternalTimestamps(pBufferData,
+ ulBufferSize,
+ ulTime,
+ ulTimeOffset, TRUE,
+ pTemporaryBuffer,
+ ulBufferSize * 2,
+ &ulOutputSize);
+
+ pNewBuffer->SetSize(ulOutputSize);
+ pBuffer = pNewBuffer;
+ }
+ else
+ {
+ //matching the createInstance in the above block
+ pBuffer->AddRef();
+ }
+}
+
+
Index: mdpshim.cpp
===================================================================
RCS file: /cvsroot/server/engine/inputsource/mdpshim.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.6.4.1
diff -u -d -r1.1.2.6 -r1.1.2.6.4.1
--- mdpshim.cpp 15 Feb 2008 07:43:14 -0000 1.1.2.6
+++ mdpshim.cpp 28 Mar 2008 04:31:42 -0000 1.1.2.6.4.1
@@ -63,9 +63,12 @@
#include "ratedescmgr.h"
-CMDPShim::CMDPShim(IHXSwitchResponse* pResp, IHXCommonClassFactory* pCCF,
- ClientSession::StreamInfo** ppStrmInfo, UINT16 num_streams)
- :BasePacketShim(pResp,pCCF,ppStrmInfo,num_streams)
+CMDPShim::CMDPShim(IHXRegistry* pReg,
+ IHXSwitchResponse* pResp,
+ IHXCommonClassFactory* pCCF,
+ ClientSession::StreamInfo** ppStrmInfo,
+ UINT16 num_streams)
+ :BasePacketShim(pReg, pResp,pCCF,ppStrmInfo,num_streams)
,m_pPacketSource(NULL)
,m_pPacketSink(NULL)
,m_pSwitchPacketSource(NULL)
Index: Umakefil
===================================================================
RCS file: /cvsroot/server/engine/inputsource/Umakefil,v
retrieving revision 1.11.8.1
retrieving revision 1.11.8.1.4.1
diff -u -d -r1.11.8.1 -r1.11.8.1.4.1
--- Umakefil 14 Dec 2007 12:42:14 -0000 1.11.8.1
+++ Umakefil 28 Mar 2008 04:31:42 -0000 1.11.8.1.4.1
@@ -64,6 +64,10 @@
, "server/qos/core/pub"
)
+if "HELIX_FEATURE_SERVER_FCS" in project.defines:
+ project.AddModuleIncludes("datatype-restricted/rm/video/payload/pub")
+
+
project.AddSources (
"srcfinder.cpp"
, "ff_source.cpp"
@@ -74,12 +78,14 @@
, "uberstreammgr.cpp"
, "streamselector.cpp"
, "asmstreamfilter.cpp"
- , "ppmstaticshim.cpp"
, "live_source_wrapper.cpp"
- , "base_shim.cpp"
- , "mdpshim.cpp"
)
+if "HELIX_FEATURE_SERVER_FCS" in project.defines:
+ project.AddSources ("base_shim.cpp",
+ "ppmstaticshim.cpp",
+ "mdpshim.cpp")
+
LibraryTarget('inputsourcelib')
DependTarget()
_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic