[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-client-cvs
Subject:    [Client-cvs] encodesvc/plugins/input/qtreader QTVideoReader.cpp,
From:       jamesanderson () helixcommunity ! org
Date:       2011-01-12 19:19:56
Message-ID: 201101121920.p0CJKKs6014413 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/client/encodesvc/plugins/input/qtreader
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv1405

Modified Files:
      Tag: PRODUCER_14_0_RN
	QTVideoReader.cpp 
Log Message:
*** PROBLEM: ******************************************************** 
bug 269203 - cli fails when encoding x264 content

*** WORK DONE: ******************************************************
Updated the two checks in the code to be more lenient when matching
the current encode time with the sample's start time.  Now there is
a small buffer to allow for content, such as x264, to have frame times
that overlap or have a gap.  Other content is much more exact.

*** TESTING: ********************************************************
Tested with x264 content, NFL content that was previously broken as
well and normal content that never failed.  All worked as expected.
Also, captured frame times upon exit and each piece of content
was in the correct order, as expected. 

*** FILES AFFECTED: *************************************************
in client\encodesvc\plugins\input\qtreader
QTVideoReader.cpp

*** BRANCHES: *******************************************************
HEAD and PRODUCER_14_0_RN

*********************************************************************
Jim Anderson (jamesanderson@real.com)
Software Development Engineer
RealNetworks, Inc.

Index: QTVideoReader.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/plugins/input/qtreader/QTVideoReader.cpp,v
retrieving revision 1.7.10.1
retrieving revision 1.7.10.2
diff -u -d -r1.7.10.1 -r1.7.10.2
--- QTVideoReader.cpp	22 Dec 2010 21:22:31 -0000	1.7.10.1
+++ QTVideoReader.cpp	12 Jan 2011 19:19:52 -0000	1.7.10.2
@@ -891,64 +891,86 @@
 {
     HX_ASSERT( puBytesRead );
 
-    // add any out of order packets, not letting displaytime get too far ahead \
                before doing so
-    if( m_OutOfOrderSamples.size() && m_tvDisplayTime >= \
m_OutOfOrderSamples[0].nStartTime ) +    // sets samples previously recieved and \
stored because they were ahead of the current time +    if( \
m_OutOfOrderSamples.size())  {
-	    SetVideoSampleData(&m_OutOfOrderSamples[0], phVideoData, puBytesRead, \
                pllStartTime, pllEndTime);
-	    m_OutOfOrderSamples.erase(m_OutOfOrderSamples.begin());
+        // for checking whether or not the first stored sample should be displayed
+        // used when small gaps between samples exist
+        // 60% was picked arbitrarily, no significant reason except to make it less \
than a full duration +        int outOfOrderDuration = \
(m_OutOfOrderSamples[0].nEndTime - m_OutOfOrderSamples[0].nStartTime) * .6;  
-	    return HXR_OK;
+        if(m_tvDisplayTime >= m_OutOfOrderSamples[0].nStartTime - \
outOfOrderDuration) +        {
+            SetVideoSampleData(&m_OutOfOrderSamples[0], phVideoData, puBytesRead, \
pllStartTime, pllEndTime); +	        \
m_OutOfOrderSamples.erase(m_OutOfOrderSamples.begin()); +
+	        return HXR_OK;
+        }
     }
 
-    // case of endTime reached
+    // end of stream reached
     if (m_tvEndTime <= m_tvDisplayTime)
     {
     	return HXR_S_END_OF_STREAM;
     }
 
-
     HX_RESULT nResult = HXR_OK;
 
+
+    // grab and set samples
     while( SUCCEEDED(nResult) )
     {
-        // grab a media sample to put into the queue
+        // grab a new sample to set
 	    QTMediaSampleData SampleData;
 	    memset(&SampleData, 0, sizeof(QTMediaSampleData));
         nResult = ReadMediaSampleData(&SampleData);
 
-        // check for end of stream
+        // end of stream reached, exit this while loop
         if(nResult == HXR_S_END_OF_STREAM)
-            break; 
+            break;
 
-        // if sample grabbed successfully  
-	    if(SUCCEEDED(nResult))
+    	if(SUCCEEDED(nResult))
 	    {
-            // if packet in correct order insert
-	        if(m_tvAdvanceDecodeTime == 0 || m_tvDisplayTime == SampleData.nStartTime)
+            // get current duration time of sample, used in determining sample \
placement +            // 60% was picked arbitrarily, no significant reason except to \
make it less than a full duration +            int currentDuration = \
((SampleData.nEndTime - SampleData.nStartTime) * .6); +
+            // if current time is within 60% of sample's start time and not after \
sample's end time, set sample +            if(m_tvAdvanceDecodeTime == 0 || \
m_tvDisplayTime == SampleData.nStartTime || +              (m_tvDisplayTime > \
SampleData.nStartTime - currentDuration && m_tvDisplayTime < SampleData.nEndTime))  {
 		        SetVideoSampleData(&SampleData, phVideoData, puBytesRead, pllStartTime, \
pllEndTime);  break;
 	        }
+            // else add sample to out-of-order queue
 	        else
 	        {
-		        // Out of order packet 
-                // find the correct place in the out of order array to insert packet
                 QTMediaSampleDataVector::iterator it;
+
+                // search for correct place to insert sample into out-of-order queue
 		        for(it = m_OutOfOrderSamples.begin(); it != m_OutOfOrderSamples.end(); \
it++)  {
-                    // if at the end of the out of order queue and not inserted
+                    // break if at end of out-of-order queue and sample not inserted \
  if(it->nStartTime > SampleData.nStartTime)
 		            {
 			            break;	
 		            }
 		        }
 
-                // insert packet into the correct position
+                // insert sample into out-of-order queue
 		        m_OutOfOrderSamples.insert(it, SampleData);
-	        }
-	    }
-    }
 
+                // if a large enough gap exists, samples will start piling up
+                // this check is for that case, would most likely be hit only if \
content was flawed +                if(m_OutOfOrderSamples.size() > 10)
+                {
+                    SetVideoSampleData(&m_OutOfOrderSamples[0], phVideoData, \
puBytesRead, pllStartTime, pllEndTime); +  	                \
m_OutOfOrderSamples.erase(m_OutOfOrderSamples.begin()); +	                break;
+                }
+            }      
+        }
+    }
     return nResult;
 }
 


_______________________________________________
Client-cvs mailing list
Client-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/client-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic