[xiph-commits] r7999 - in trunk/oggdsf/src/lib: core/directshow/dsfAnxDemux core/directshow/dsfOggDemux core/ogg/libOOOggSeek player/libDSPlayDotNET

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Thu Oct 14 08:45:24 PDT 2004


Author: illiminable
Date: 2004-10-14 08:45:24 -0700 (Thu, 14 Oct 2004)
New Revision: 7999

Modified:
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
   trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
   trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
Log:
* Fixed a bug where sockets weren't properly being closed.
* Fixed a bug where the thread loop on the socket wasn't properly accetpting the shutdown thread message.
* DNPlay now follows http Annodex links correctly.

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/AnxDemuxSourceFilter.cpp	2004-10-14 15:45:24 UTC (rev 7999)
@@ -72,6 +72,7 @@
 
 AnxDemuxSourceFilter::~AnxDemuxSourceFilter(void)
 {
+	anxDebug<<"Deconstructing anx filter"<<endl;
 }
 
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2004-10-14 15:45:24 UTC (rev 7999)
@@ -35,7 +35,8 @@
 	:	mBufferLock(NULL)
 {
 	mBufferLock = new CCritSec;
-	//debugLog.open("G:\\logs\\httpdebug.log", ios_base::out);
+	debugLog.open("G:\\logs\\httpdebug.log", ios_base::out | ios_base::ate | ios_base::app);
+	debugLog<<"==========================================="<<endl;
 	//fileDump.open("G:\\filedump.ogg", ios_base::out|ios_base::binary);
 
 
@@ -45,8 +46,10 @@
 
 HTTPFileSource::~HTTPFileSource(void)
 {
-	//debugLog<<"Winsock ended"<<endl;
-	//debugLog.close();
+	debugLog<<"About to close socket"<<endl;
+	close();
+	debugLog<<"Winsock ended"<<endl;
+	debugLog.close();
 	//fileDump.close();
 	delete mBufferLock;
 	
@@ -56,21 +59,27 @@
 	//debugLog<<"DataProcessLoop: "<<endl;
 	int locNumRead = 0;
 	char* locBuff = NULL;
+	DWORD locCommand = 0;
 	const unsigned long RECV_BUFF_SIZE = 1024;
 	locBuff = new char[RECV_BUFF_SIZE];
 	while(true) {
+		if(CheckRequest(&locCommand) == TRUE) {
+			debugLog<<"Thread Data Process loop received breakout signal..."<<endl;
+			delete[] locBuff;
+			return;
+		}
 		//debugLog<<"About to call recv"<<endl;
 		locNumRead = recv(mSocket, locBuff, RECV_BUFF_SIZE, 0);
 		//debugLog<<"recv complete"<<endl;
 		if (locNumRead == SOCKET_ERROR) {
 			int locErr = WSAGetLastError();
-			//debugLog<<"Socket error receiving - Err No = "<<locErr<<endl;
+			debugLog<<"Socket error receiving - Err No = "<<locErr<<endl;
 			mWasError = true;
 			break;
 		}
 
 		if (locNumRead == 0) {
-			//debugLog<<"Read last bytes..."<<endl;
+			debugLog<<"Read last bytes..."<<endl;
 			mIsEOF = true;
 			delete[] locBuff;
 			return;
@@ -170,6 +179,17 @@
 
 
 void HTTPFileSource::close() {
+	//Killing thread
+	debugLog<<"HTTPFileSource::close()"<<endl;
+	if (ThreadExists() == TRUE) {
+		debugLog<<"Calling Thread to EXIT"<<endl;
+		CallWorker(THREAD_EXIT);
+		debugLog<<"Killing thread..."<<endl;
+		Close();
+		debugLog<<"After Close called on CAMThread"<<endl;
+	}
+	
+	debugLog<<"Closing socket..."<<endl;
 	//Close the socket down.
 	closeSocket();
 }
@@ -186,7 +206,7 @@
 	//
 	mSeenResponse = false;
 	mLastResponse = "";
-	//debugLog<<"Open: "<<inSourceLocation<<endl;
+	debugLog<<"Open: "<<inSourceLocation<<endl;
 
 	{ //CRITICAL SECTION - PROTECTING STREAM BUFFER
 		CAutoLock locLock(mBufferLock);
@@ -212,7 +232,7 @@
 		
 		locCacheFileName += StringHelper::numToString(locRand);
 		locCacheFileName += ".ogg";
-		//debugLog<<"Cache file  = "<<locCacheFileName<<endl;
+		debugLog<<"Cache file  = "<<locCacheFileName<<endl;
 		if(mFileCache.open(locCacheFileName)) {
 			//debugLog<<"OPEN : Cach file opened"<<endl;
 		}
@@ -221,16 +241,16 @@
 	bool locIsOK = setupSocket(inSourceLocation);
 
 	if (!locIsOK) {
-		//debugLog<<"Setup socket FAILED"<<endl;
+		debugLog<<"Setup socket FAILED"<<endl;
 		closeSocket();
 		return false;
 	}
 
-	//debugLog<<"Sending request..."<<endl;
+	debugLog<<"Sending request..."<<endl;
 
 	//How is filename already set ??
 	httpRequest(assembleRequest(mFileName));
-	//debugLog<<"Socket ok... starting thread"<<endl;
+	debugLog<<"Socket ok... starting thread"<<endl;
 	locIsOK = startThread();
 
 
@@ -249,7 +269,7 @@
 
 		//debugLog<<"isEOF : Amount Buffered avail = "<<locSizeBuffed<<endl;
 		if ((locSizeBuffed == 0) && mIsEOF) {
-			//debugLog<<"isEOF : It is EOF"<<endl;
+			debugLog<<"isEOF : It is EOF"<<endl;
 			return true;
 		} else {
 			//debugLog<<"isEOF : It's not EOF"<<endl;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-10-14 15:45:24 UTC (rev 7999)
@@ -75,7 +75,7 @@
 	//stringstream mStreamBuffer;
 	SingleMediaFileCache mFileCache;
 
-	//fstream debugLog;
+	fstream debugLog;
 	//fstream fileDump;
 
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourceFilter.cpp	2004-10-14 15:45:24 UTC (rev 7999)
@@ -117,8 +117,8 @@
 	debugLog.open("g:\\logs\\sourcelog.log", ios_base::out | ios_base::ate | ios_base::app);
 	//debugLog<<"Test..."<<endl;
 	//debugLog.seekp(0, ios_base::end);
-	debugLog<<"Test2..."<<endl;
-	//debugLog << "**************** Starting LOg ********************"<<endl;
+	//debugLog<<"Test2..."<<endl;
+	debugLog << "**************** Starting LOg ********************"<<endl;
 
 }
 
@@ -153,6 +153,7 @@
 	//delete mSourceFileLock;
 	//delete mDemuxLock;
 	debugLog<<"Deleting Data Source : "<<(int)mDataSource<<endl;
+	mDataSource->close();
 	delete mDataSource;
 	debugLog.close();
 	
@@ -493,6 +494,7 @@
 		//
 		//Before opening make the interface
 		mDataSource = DataSourceFactory::createDataSource(StringHelper::toNarrowStr(mFileName).c_str());
+		debugLog<<"reset Stream"<<endl;
 		mDataSource->open(StringHelper::toNarrowStr(mFileName).c_str());
 		mDataSource->seek(mStreamMapper->startOfData());   //Should always be zero for now.
 
@@ -642,6 +644,7 @@
 	//mSourceFile.open(StringHelper::toNarrowStr(mFileName).c_str(), ios_base::in|ios_base::binary);
 	//
 	//Before openeing create the interface
+	debugLog<<"Set up pins..."<<endl;
 	mDataSource = DataSourceFactory::createDataSource(StringHelper::toNarrowStr(mFileName).c_str());
 	mDataSource->open(StringHelper::toNarrowStr(mFileName).c_str());
 	//

Modified: trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/core/ogg/libOOOggSeek/AutoOggSeekTable.cpp	2004-10-14 15:45:24 UTC (rev 7999)
@@ -210,7 +210,7 @@
 }
 bool AutoOggSeekTable::buildTable() {
 	//HACK::: To ensure we don't try and build a table on the network file.
-	debugLog<<"Anx Build table : "<<mFileName<<endl;
+	//debugLog<<"Anx Build table : "<<mFileName<<endl;
 	if (mFileName.find("http") != 0) {
 		
 		debugLog<<"Opening file... "<<endl;

Modified: trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
===================================================================
--- trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp	2004-10-14 13:16:09 UTC (rev 7998)
+++ trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp	2004-10-14 15:45:24 UTC (rev 7999)
@@ -112,6 +112,8 @@
 //	} 
 
 DSPlay::~DSPlay(void) {
+	*debugLog<<"Killing DSPlay"<<endl;
+	debugLog->close();
 	delete debugLog;
 	releaseInterfaces();
 	CoUninitialize();
@@ -151,6 +153,7 @@
 		mCMMLAppControl = NULL;
 	}
 
+	*debugLog<<"Before Graph release..."<<endl;
 	if (mGraphBuilder != NULL) {
 		numRef =
             mGraphBuilder->Release();
@@ -160,7 +163,7 @@
 	}
 
 
-
+	*debugLog<<"After graph release>.."<<endl;
 	//TODO::: Release everything !
 }
 
@@ -222,7 +225,7 @@
 
 	}
 
-	debugLog<<"About to call render on "<<StringHelper::toNarrowStr(locWFileName)<<endl;
+	*debugLog<<"About to call render on "<<endl;
 	//Build the graph
 	locHR = mGraphBuilder->RenderFile(locWFileName.c_str(), NULL);
 



More information about the commits mailing list