[xiph-commits] r10772 - branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2

illiminable at svn.xiph.org illiminable at svn.xiph.org
Mon Jan 30 03:41:29 PST 2006


Author: illiminable
Date: 2006-01-30 03:41:24 -0800 (Mon, 30 Jan 2006)
New Revision: 10772

Modified:
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h
Log:
* Keep track of the absolute read position in the stream for future evil deeds

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp	2006-01-30 11:17:06 UTC (rev 10771)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.cpp	2006-01-30 11:41:24 UTC (rev 10772)
@@ -38,6 +38,7 @@
 	,	mIsFirstChunk(true)
 	,	mChunkRemains(0)
 	,	mNumLeftovers(0)
+	,	mCurrentAbsoluteReadPosition(0)
 	,	mMemoryBuffer(NULL)
 	,	mContentLength(-1)
 	,	mIsBufferFilling(false)
@@ -399,8 +400,11 @@
 	//Open up a new one to the same place.
 	//Make the partial content request.
 	//debugLog<<"Seeking to "<<inPos<<endl;
+
+	//Keep track of the absolute position we are looking at in the file.
+	mCurrentAbsoluteReadPosition = inPos;
 	
-	if ((mContentLength != -1) || (inPos == 0)){
+	if ((mContentLength != -1) || (inPos == 0)) {
 		close();
 		closeSocket();
 		clear();
@@ -502,6 +506,7 @@
 	mIsFirstChunk = true;
 	mChunkRemains = 0;
 	mNumLeftovers = 0;
+	mCurrentAbsoluteReadPosition = 0;
 	//mSourceLocation = "";
 	//mContentLength = -1;
 }
@@ -548,7 +553,7 @@
 			//}
 
 			if (locNumRead > 0) {
-				debugLog<<locNumRead<<" bytes read from buffer"<<endl;
+				debugLog<<locNumRead<<" bytes read from buffer at "<<mCurrentAbsoluteReadPosition<< endl;
 			}
 
 			//if (mMemoryBuffer->numBytesAvail() <= MEMORY_BUFFER_LOW_TIDE) {
@@ -561,5 +566,7 @@
 	if ((mMemoryBuffer->numBytesAvail() <= MEMORY_BUFFER_LOW_TIDE) && (!mIsBufferFilling) && (!mIsEOF)) {
 		CallWorker(THREAD_RUN);
 	}
+
+	mCurrentAbsoluteReadPosition += locNumRead;
 	return locNumRead;
 }

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h	2006-01-30 11:17:06 UTC (rev 10771)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/HTTPStreamingFileSource.h	2006-01-30 11:41:24 UTC (rev 10772)
@@ -97,6 +97,21 @@
 	unsigned long mNumLeftovers;
 	static	const unsigned long RECV_BUFF_SIZE = 1024;
 
+	//Fix for seekback on headers - since we only maintain a forward buffer. The seek back to start which occurs
+	//	right after the headers are processed, will generally trigger a stream reset. But an annodex server,
+	//	will serve out a file with completely different serial numbers, making it impossible to map the streams
+	//	using the originally gathered information.
+	//
+	//Now we are going to buffer up the first part of the file into yet another buffer. Also keep track
+	//	of what the absolute byte position is we have read up to so far from the stream. When we receive a seek request,
+	//	we check if the current read position is within this new buffer.
+	//
+	//If it is, then we can set a flag, and respond to read requests from this new buffer, up until the point
+	//	where the stream was before the seek, then switch back to serving out live streaming data.
+	unsigned long mCurrentAbsoluteReadPosition;
+	
+	//
+
 	__int64 mContentLength;
 
 	CCritSec* mBufferLock;



More information about the commits mailing list