CR/CN: Cayenne to Atlas merge in SourceSplitter

Tad Yeager <[email protected]>
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
csrcsplt.cpp.txt (text/plain, 4.2 KB)
Modified by: [email protected]
Date: 04:02:2009
Project: Atlas_3_1_0
Bug Number: N/A
Bug URL: N/A

Synopsis: Merge from Cayenne to Atlas of CSourceSplitter processing OnStreamDone

Overview: Cayenne based clients use DataTypeDriver for validation of files prior to conversion, invoking Drive twice.  When invoking Dtdr for file validation, clients need to get OnStreamDone notification before packets arrive because packets aren't coming, causing deadlock.  

Files Modified: datatype\tools\dtdriver\engine\csrccsplt.cpp 
Image Size and Heap Use impact (Client -Only): minimal.
Platforms and Profiles Affected: All
Distribution Libraries Affected: hxtdtriver.dll,.so dtdr3260.dll,.so and binaries dependent dtdr_platform_lib.lib, dtdr_stdalone_lib.lib
Platforms and Profiles Build Verified: Win32 
Platforms and Profiles Functionality verified: Win32

Branch: Atlas_3_1_0, HEAD
Copyright assignment: I am a RealNetworks employee or contractor
QA Instructions:


Index: csrcsplt.cpp
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/engine/csrcsplt.cpp,v
retrieving revision 1.6.10.4
diff -u -4 -0 -r1.6.10.4 csrcsplt.cpp
--- csrcsplt.cpp	20 Feb 2009 22:24:12 -0000	1.6.10.4
+++ csrcsplt.cpp	3 Apr 2009 00:01:03 -0000
@@ -771,83 +771,96 @@
  *	Method:
  *	    IHXSourceInput:OnStreamDone
  *	Purpose:
  *	    Called to signal the end of particular stream from the source.
  */
 STDMETHODIMP CSourceSplitter::OnStreamDone(HX_RESULT status,
 					   UINT16    unStreamNumber)
 {
     HXLOGL4(HXLOG_DTDR, "CSourceSplitter[%p]::OnStreamDone(status=0x%08x,streamNum=%u)", this, status, unStreamNumber);
     HX_RESULT retVal = HXR_OK;
 
     if (!m_pStreamStatusArray)
     {
 	retVal = HXR_UNEXPECTED;
     }
 
     if (SUCCEEDED(retVal))
     {
 	retVal = HXR_FAIL;
 	if (unStreamNumber < m_ulNumStreams)
 	{
 	    retVal = HXR_OK;
 	}
     }
 
     if (SUCCEEDED(retVal))
     {
 	retVal = HXR_UNEXPECTED;
 	if (m_pStreamStatusArray[unStreamNumber].m_pProcessorInput)
 	{
 	    retVal = HXR_OK;
 	}
     }
 
     if (SUCCEEDED(retVal))
     {
         // Set the flag saying we have a pending OnStreamDone() call for this processor
         m_pStreamStatusArray[unStreamNumber].m_bOnStreamDonePending = TRUE;
         // Save the status
         m_pStreamStatusArray[unStreamNumber].m_statusOnStreamDone = status;
-        // Check to see if there are any queued packets which 
-        // must be sent to the procesor.
-        CheckInputPacketQueue((UINT32) unStreamNumber);
+        // Have we received any packets on this stream?
+        if (m_pStreamStatusArray[unStreamNumber].m_bFirstInputPacket)
+        {
+            // We have not received any packets on this stream, so
+            // we sould just pass the OnStreamDone() through to the processor
+            CallOnStreamDone(unStreamNumber);
+        }
+        else
+        {
+            // We have received packets on this stream, so we should
+            // check the input queue to see if and when we
+            // need to call OnStreamDone()  on the processor.
+            // Check to see if there are any queued packets which 
+            // must be sent to the procesor.
+            CheckInputPacketQueue((UINT32) unStreamNumber);
+        }
     }
 
     return retVal;
 }
 
 /************************************************************************
  *	Method:
  *	    IHXSourceInput:OnPacket
  *	Purpose:
  *	    Called to send packet information.
  *
  */
 STDMETHODIMP CSourceSplitter::OnPacket(HX_RESULT status, IHXPacket* pPacket)
 {
     HXLOGPKTL4(HXLOG_DTDR, "CSourceSplitter::OnPacket", pPacket);
     HX_RESULT retVal = HXR_FAIL;
 
     UINT32 ulStreamNumber = 0;
     if (pPacket)
     {
 	ulStreamNumber = (UINT32) pPacket->GetStreamNumber();
     }
 
     if (m_pStreamStatusArray &&
 	(ulStreamNumber < m_ulNumStreams) &&
 	m_pStreamStatusArray[ulStreamNumber].m_pProcessorInput)
     {
 	if (m_pStreamStatusArray[ulStreamNumber].m_bFirstInputPacket &&
 	    pPacket)
 	{
 	    IHXRTPPacket* pRTPPacket = NULL;
 
 	    m_pStreamStatusArray[ulStreamNumber].m_bFirstInputPacket = FALSE;
 	    
 	    m_pStreamStatusArray[ulStreamNumber].m_bUsesRTPPacketsOnInput = 
 		(pPacket->QueryInterface(IID_IHXRTPPacket, 
 					 (void**) &pRTPPacket) == HXR_OK);
 
 	    HX_RELEASE(pRTPPacket);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.