[xiph-commits] r7643 - in trunk/oggdsf/src/lib: codecs/flac/filters/dsfFLACDecoder core/directshow/dsfAbstractAudioDecoder core/directshow/dsfOggDemux core/directshow/dsfSeeking

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Fri Aug 27 02:37:33 PDT 2004


Author: illiminable
Date: 2004-08-27 02:37:32 -0700 (Fri, 27 Aug 2004)
New Revision: 7643

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeFilter.h
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.h
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.h
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.h
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfSeeking/BasicSeekable.h
Log:
* Fixed another circular refernce problem that was stopping destructors being fired.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeFilter.h	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeFilter.h	2004-08-27 09:37:32 UTC (rev 7643)
@@ -39,6 +39,7 @@
 	FLACDecodeFilter(void);
 	virtual ~FLACDecodeFilter(void);
 
+
 	friend class FLACDecodeInputPin;
 	friend class FLACDecodeOutputPin;
 

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.h	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.h	2004-08-27 09:37:32 UTC (rev 7643)
@@ -53,6 +53,7 @@
 	FLACDecodeInputPin(AbstractAudioDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractAudioDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType);
 	virtual ~FLACDecodeInputPin(void);
 
+
 	HRESULT SetMediaType(const CMediaType* inMediaType);
 
 	virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes);

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.cpp	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.cpp	2004-08-27 09:37:32 UTC (rev 7643)
@@ -33,6 +33,7 @@
 // dsfFLACDecoder.pch will be the pre-compiled header
 // stdafx.obj will contain the pre-compiled type information
 
+
 #include "stdafx.h"
 
 // TODO: reference any additional headers you need in STDAFX.H

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.h	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/stdafx.h	2004-08-27 09:37:32 UTC (rev 7643)
@@ -41,4 +41,5 @@
 // Windows Header Files:
 #include <windows.h>
 
+
 // TODO: reference additional headers your program requires here

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp	2004-08-27 09:37:32 UTC (rev 7643)
@@ -47,6 +47,10 @@
 	
 }
 
+//STDMETHODIMP_(ULONG) AbstractAudioDecodeFilter::NonDelegatingRelease() {
+//	ULONG x = CBaseFilter::NonDelegatingRelease();
+//	return x;
+//}
 void AbstractAudioDecodeFilter::DestroyPins() {
 	delete mOutputPin;
 	delete mInputPin;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.h	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.h	2004-08-27 09:37:32 UTC (rev 7643)
@@ -53,7 +53,7 @@
 	//COM Setup
 	DECLARE_IUNKNOWN
 	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
-
+	//STDMETHODIMP_(ULONG) NonDelegatingRelease();
 	//Constants and Enumerations
 	static const long NUM_PINS = 2;
 	enum eAudioFormat {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeInputPin.cpp	2004-08-27 09:37:32 UTC (rev 7643)
@@ -51,9 +51,30 @@
 	mAcceptableMediaType = inAcceptMediaType;
 	mStreamLock = new CCritSec;
 
-	IMediaSeeking* locSeeker = NULL;
-	this->NonDelegatingQueryInterface(IID_IMediaSeeking, (void**)&locSeeker);
-	mOutputPin->SetDelegate(locSeeker);
+	//This is causing a problem... since every addref on a pin automatically
+	// adds a ref to the filter... we get the situation, where on shutdown
+	// the output pin still hold a ref on the input pin due to this bit of code
+	// So at shutdown, 
+	// the input pin has a ref count of 1
+	// the output pin has a ref count of 0 (it's released by the downstream filter)
+	// the filter has a ref count of 1 by way of the automatic addref from the input pin
+	// This means that even when everything else releases all it's refs on the filter
+	// it still has a ref count of 1... and since currently the ref that the
+	// output pin holds on the input pin isn't release until the output pin is
+	// destroyed, and the output pin isn't destroyed until the filter is
+	// we get a circular reference.
+	//
+	//New solution is to attach this reference (from output to input) on the
+	// complete connect method of the output pin via mParentfilter
+	// and to release it when on the break conncet of the output pin.
+	// This means that now as soon as the downstream filter releases the output
+	// pin, it will release it's ref on the input pin, leaving the pins and the filer with
+	// zero ref counts... well thats the plan anyway.
+	//
+	//IMediaSeeking* locSeeker = NULL;
+	//this->NonDelegatingQueryInterface(IID_IMediaSeeking, (void**)&locSeeker);
+	//mOutputPin->SetDelegate(locSeeker);
+	//
 }
 
 STDMETHODIMP AbstractAudioDecodeInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp	2004-08-27 09:37:32 UTC (rev 7643)
@@ -42,7 +42,7 @@
 }
 AbstractAudioDecodeOutputPin::~AbstractAudioDecodeOutputPin(void)
 {	
-
+	ReleaseDelegate();
 	delete mDataQueue;
 	mDataQueue = NULL;
 }
@@ -167,11 +167,19 @@
 	//QUERY:: Locks ???
 	mDataQueue->BeginFlush();
     return S_OK;
+	
 }
 
 HRESULT AbstractAudioDecodeOutputPin::CompleteConnect (IPin *inReceivePin) {
 	HRESULT locHR = S_OK;
 
+	//Here when another pin connects to us, we internally connect the seek delegate
+	// from this output pin onto the input pin... and we release it on breakconnect.
+	//
+	IMediaSeeking* locSeeker = NULL;
+	mParentFilter->mInputPin->NonDelegatingQueryInterface(IID_IMediaSeeking, (void**)&locSeeker);
+	SetDelegate(locSeeker);
+	//
 	mDataQueue = new COutputQueue (inReceivePin, &locHR, FALSE, TRUE, 1, TRUE, 20);
 	if (FAILED(locHR)) {
 		locHR = locHR;
@@ -181,8 +189,9 @@
 }
 
 HRESULT AbstractAudioDecodeOutputPin::BreakConnect(void) {
-	HRESULT locHR = CBaseOutputPin::BreakConnect();
+
+	ReleaseDelegate();
 	delete mDataQueue;
 	mDataQueue = NULL;
-	return locHR;
+	return CBaseOutputPin::BreakConnect();
 }
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp	2004-08-27 09:37:32 UTC (rev 7643)
@@ -193,7 +193,7 @@
 	mServerName = locServerName;
 	mFileName = locPath;
 	if (locPort != "") {
-		//Error checking needed
+		//TODO::: Error checking needed
 		mPort = atoi(locPort.c_str());
 	} else {
 		mPort = 0;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfSeeking/BasicSeekable.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfSeeking/BasicSeekable.h	2004-08-27 06:49:38 UTC (rev 7642)
+++ trunk/oggdsf/src/lib/core/directshow/dsfSeeking/BasicSeekable.h	2004-08-27 09:37:32 UTC (rev 7643)
@@ -8,7 +8,7 @@
 public:
 	BasicSeekable(void);
 	BasicSeekable(IMediaSeeking* inDelegate);
-	~BasicSeekable(void);
+	virtual ~BasicSeekable(void);
 
 	bool SetDelegate(IMediaSeeking* inDelegate);
 	bool ReleaseDelegate();



More information about the commits mailing list