[xiph-commits] r10107 - trunk/oggdsf/src/lib/core/directshow/dsfOggDemux

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Oct 1 01:30:12 PDT 2005


Author: illiminable
Date: 2005-10-01 01:30:07 -0700 (Sat, 01 Oct 2005)
New Revision: 10107

Modified:
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
Log:
* Correctly follows a link contained in a 301 Moved Permanently response.

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2005-10-01 08:20:12 UTC (rev 10106)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2005-10-01 08:30:07 UTC (rev 10107)
@@ -239,6 +239,7 @@
 					if (locResponseCode == 301) {
 						size_t locLocPos = mLastResponse.find("Location: ");
 						if (locLocPos != string::npos) {
+							locLocPos += 10;
 							size_t locEndPos = mLastResponse.find("\r", locLocPos);
 							if (locEndPos != string::npos) {
 								if (locEndPos > locLocPos) {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2005-10-01 08:20:12 UTC (rev 10106)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2005-10-01 08:30:07 UTC (rev 10107)
@@ -621,6 +621,8 @@
 	CAutoLock locDemuxLock(mDemuxLock);
 	CAutoLock locSourceLock(mSourceFileLock);
 	
+	unsigned short locRetryCount = 0;
+	const unsigned short RETRY_THRESHOLD = 3;
 	debugLog<<"SETUP PINS"<<endl;
 	//Create and open a data source
 	mDataSource = DataSourceFactory::createDataSource(StringHelper::toNarrowStr(mFileName).c_str());
@@ -644,8 +646,18 @@
 		}
 
 		if (mDataSource->isEOF() || mDataSource->isError()) {
-			debugLog<<"Bailing out"<<endl;
-			return VFW_E_CANNOT_RENDER;
+			if (mDataSource->isError() && (mDataSource->shouldRetryAt() != "") && (locRetryCount < RETRY_THRESHOLD)) {
+				mOggBuffer.clearData();
+				string locNewLocation = mDataSource->shouldRetryAt();
+				debugLog<<"Retrying at : "<<locNewLocation<<endl;
+				delete mDataSource;
+				mDataSource = DataSourceFactory::createDataSource(locNewLocation.c_str());
+				mDataSource->open(locNewLocation.c_str());
+				locRetryCount++;
+			} else {
+				debugLog<<"Bailing out"<<endl;
+				return VFW_E_CANNOT_RENDER;
+			}
 		}
 	}
 	



More information about the commits mailing list