[xiph-commits] r8485 - trunk/oggdsf/src/lib/core/ogg/libOOOgg

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Sat Dec 18 22:15:27 PST 2004


Author: illiminable
Date: 2004-12-18 22:15:26 -0800 (Sat, 18 Dec 2004)
New Revision: 8485

Modified:
   trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.cpp
Log:
* Fixed out of order BOS pages.

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.cpp	2004-12-19 05:36:20 UTC (rev 8484)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOgg/OggPageInterleaver.cpp	2004-12-19 06:15:26 UTC (rev 8485)
@@ -112,6 +112,8 @@
 
 }
 
+
+
 void OggPageInterleaver::writeLowest() {
 		OggMuxStream* locLowestStream = NULL;
 		for (size_t i = 0; i < mInputStreams.size(); i++) {
@@ -133,6 +135,9 @@
 					debugLog<<"writeLowest : UNSCAL : Curr = "<<locCurrLowTimeUNS<<" -- Test["<<i<<"] = "<<locTestLowTimeUNS<<endl;
 
 					
+					//ASSERT (all header packets have granule pos 0)
+					//
+
 					//In english this means... any bos pages go first... then any no gran pos pages (-1 gran pos).. 
 					// then any remaining streams with headers then whoevers got the lowest time.
 					if (
@@ -142,8 +147,10 @@
 						(	(mInputStreams[i]->peekFront() != NULL) && 
 							((mInputStreams[i]->peekFront()->header()->GranulePos()) == -1) ) ||
 							
+						//Only choose a stream which hasn't sent all it's headers if the best one so far isn't a BOS
 						(	(mInputStreams[i]->peekFront() != NULL) && 
-							(!mInputStreams[i]->sentAllHeaders()) ) ||
+							(!mInputStreams[i]->sentAllHeaders()) &&
+							(!locLowestStream->peekFront()->header()->isBOS()) ) ||
 						
 							(locTestLowTime < locCurrLowTime)
 						) 
@@ -160,9 +167,10 @@
 						}
 
 						if	((mInputStreams[i]->peekFront() != NULL) && 
-							(!mInputStreams[i]->sentAllHeaders()) ) {
+							(!mInputStreams[i]->sentAllHeaders()) &&
+							(!locLowestStream->peekFront()->header()->isBOS()) ) {
 
-									debugLog<<"WriteLowest : Selecting because sent all headers"<<endl;
+									debugLog<<"WriteLowest : Selecting because hasn't sent all headers"<<endl;
 						}
 
 						if (locTestLowTime < locCurrLowTime) {



More information about the commits mailing list