[xiph-commits] r8106 - trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Oct 26 08:37:34 PDT 2004


Author: illiminable
Date: 2004-10-26 08:37:34 -0700 (Tue, 26 Oct 2004)
New Revision: 8106

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
Log:
* Seeking crashes fixed with a few locks.
* Seeking is now very sluggish... sometimes 3 seond latency.
* There's an internal bug still causing an infinite destruction loop.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-26 15:10:52 UTC (rev 8105)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-26 15:37:34 UTC (rev 8106)
@@ -69,6 +69,7 @@
 	//,	mDecoder(NULL)
 {
 	m_pLock = new CCritSec;
+	mCodecLock = new CCritSec;
 	debugLog.open("G:\\logs\\NativeFLAC.log", ios_base::out);
 	mFLACSourcePin = new NativeFLACSourcePin(this, m_pLock);
 }
@@ -78,6 +79,7 @@
 	debugLog.close();
 	delete mFLACSourcePin;
 	mFLACSourcePin = NULL;
+	delete mCodecLock;
 }
 
 //BaseFilter Interface
@@ -244,13 +246,20 @@
 		if (mJustStopped) {
 			mJustStopped = false;
 			debugLog<<"!!!!!!!!!!!!!!!!!!!!!!! SEEK ABSOLUTE 0"<<endl;
-			bool res2 = seek_absolute(0);
+			bool res2 = false;
+			{
+				CAutoLock locLock(mCodecLock);
+				res2 = seek_absolute(0);
+			}
 			if (res2) {
 				debugLog<<"Seek absolute success"<<endl;
 			}
 		}
-		debugLog<<"Process it"<<endl;
-		res = process_single();
+		{
+			CAutoLock locLock(mCodecLock);
+			debugLog<<"Process it"<<endl;
+			res = process_single();
+		}
 		if (res) {
 			debugLog<<"Process OK"<<endl;
 		} else {
@@ -433,12 +442,17 @@
 }
 STDMETHODIMP NativeFLACSourceFilter::SetPositions(LONGLONG *pCurrent,DWORD dwCurrentFlags,LONGLONG *pStop,DWORD dwStopFlags){
 	debugLog<<"Request seek to "<<*pCurrent<<endl;
-	mUpto = 0;
+	
 	unsigned __int64 locSampleToSeek = (*pCurrent) * mSampleRate/ UNITS;
 	debugLog<<"W**** Which is sample no = "<<locSampleToSeek<<endl;
 	mFLACSourcePin->DeliverBeginFlush();
 	mFLACSourcePin->DeliverEndFlush();
-	bool locRes = seek_absolute(locSampleToSeek);
+	bool locRes = false;
+	{
+		CAutoLock locLock(mCodecLock);
+		mUpto = 0;
+		locRes = seek_absolute(locSampleToSeek);
+	}
 	if (locRes) {
 		debugLog<<"Seek suceeded"<<endl;
 	} else {

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-26 15:10:52 UTC (rev 8105)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-26 15:37:34 UTC (rev 8106)
@@ -142,4 +142,6 @@
 	unsigned long mBitsPerSample;
 	__int64 mTotalNumSamples;
 
+	CCritSec* mCodecLock;
+
 };



More information about the commits mailing list