[xiph-commits] r8028 - trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Sat Oct 16 07:18:18 PDT 2004


Author: illiminable
Date: 2004-10-16 07:18:17 -0700 (Sat, 16 Oct 2004)
New Revision: 8028

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
Log:
* Added locks around FLAC.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp	2004-10-16 14:16:34 UTC (rev 8027)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp	2004-10-16 14:18:17 UTC (rev 8028)
@@ -118,19 +118,9 @@
 }
 ::FLAC__StreamDecoderWriteStatus FLACDecodeInputPin::write_callback(const ::FLAC__Frame* inFrame, const FLAC__int32* const inBuffer[]) 
 {
-	//inFrame->header.blocksize
-
-	
-		//Do we need to delete the pcm structure ???? 
-	//More of this can go to the abstract class.
 
-	//For convenience we do all these cast once and for all here.
-
-	//locFilter	
 	if (! mBegun) {
-		
 	
-		
 		mBegun = true;
 		
 		mNumChannels = inFrame->header.channels;
@@ -288,7 +278,9 @@
 			ASSERT((locBuff[0] == 255) && (locBuff[1] == 248));
 			if (mPendingPackets.size() == 1) {
 				//debugLog<<"decodeData : Calling process_single with 1 packet."<<endl;
-				locRet = process_single();
+				
+					locRet = process_single();
+			
 			} else {
 				//debugLog<<"decodeData : Something bad happened !"<<endl;
 				return -1;
@@ -297,8 +289,10 @@
 			//}
 			//mNumPacksBuffered = 0;
 		} else {
+		
+				CAutoLock locCodecLock(mCodecLock);
+				int locRet = process_until_end_of_metadata();
 			
-			int locRet = process_until_end_of_metadata();
 			mGotMetaData = true;
 		}
 		//debugLog<<"decodeData : Successful return."<<endl;
@@ -323,11 +317,14 @@
 
 STDMETHODIMP FLACDecodeInputPin::BeginFlush() {
 	CAutoLock locLock(mFilterLock);
-	CAutoLock locCodecLock(mCodecLock);
+	
 	//debugLog<<"BeginFlush : Calling flush on the codec."<<endl;
 
 	HRESULT locHR = AbstractAudioDecodeInputPin::BeginFlush();
-	flush();
+	{	//PROTECT CODEC FROM IMPLODING
+		CAutoLock locCodecLock(mCodecLock);
+		flush();
+	}	//END CRITICAL SECTION
 	unsigned long locSize = mPendingPackets.size();
 	//debugLog<<"BeginFlush : deleting "<<locSize<<" packets."<<endl;
 	for (unsigned long i = 0; i < locSize; i++) {
@@ -339,7 +336,12 @@
 }
 
 STDMETHODIMP FLACDecodeInputPin::EndOfStream(void) {
-	flush();
+	CAutoLock locStreamLock(mStreamLock);
+	{	//PROTECT CODEC FROM IMPLODING
+		CAutoLock locCodecLock(mCodecLock);
+		flush();
+	}	//END CRITICAL SECTION
+
 	unsigned long locSize = mPendingPackets.size();
 	for (unsigned long i = 0; i < locSize; i++) {
 		delete mPendingPackets.front();



More information about the commits mailing list