I'm currently trying to implement my own source filter in order to decode a MOV file given as input. I have been following the various examples available on the web and within the WinSDK 7.1 samples folder and I ended up with the following :
A CSource subclass that implements CreateInstance
A CSourceStream subclass that uimplements the following :
- DecideBufferSize
- GetMediaType
- Notify
- FillBuffer
Note that I'm currently not implementing any kind of seeking handling.
Currently my filter can be instantiated through graphstudio and exposes 1 video output pin. I am able to render it all the way through the VMR7.
My issue comes when i click play. My FillBuffer method is called once and graphstudio fails reporting an assert failure inside source.cpp @ line 317 : ASSERT(!ThreadExists()).
Could anyone tell me what I'm doing wrong here ? It seems like there is some kind of issue with the ::Active() method of the base pin but I'm not sure what exactly.
I'll be happy to provide with more detailed source code if needed.
Thanks in advance.
2 Answers 2
Ok so I finally got it working.
If anyone encounters the same issue, this came from the pin registration from the CSource filter. I was using the AddPin method to register my pin. This somehow caused the CSource internal state to fail in some way. Accessing directly the m_paStreams array as done in the directshow sample resolved my problem.
Comments
The issue is presumably caused by the way you override base classes methods.
Assertion failure suggest that execution reached the place where it should not be at all until filter is stopped and then re-started once again. I would say that it should have returned higher a few lines (line 303) but for some reason it did not. The wrong value of IsActive does not indicate the method itself is wrong, instead it is likely to be something with an override.