View Full Version : DirectShow Speed Bug


rse
18th October 2008, 00:27
Hi!

Iīm currently writing on my own mediaplayer. For playback Iīm totally relying on DirectShow. It provides a possibility to change playback rate, which uses the IMediaSeeking::SetRate function of DirectShow. The Problem is as follows:

When IMediaSeeking::SetRate is set to a higher playback speed, then the media plays faster as expected. Iīm polling IMediaSeeking::GetCurrentPosition for measuring the playback rate and setting the progress bar. But when the progress bar is at the end, the music is still playing! The faster the speed and the longer the time, the bigger is the difference between real end of the file and the time when the position from IMediaSeeking::GetCurrentPosition reaches the end position. After reaching the end position IMediaSeeking::GetCurrentPosition always returns the end position. The EC_COMPLETE-Message is sent at the real end of the file. So the only problem is the wrong position reported, and this is only wrong when speed is modified (slower or faster).

Is DirectShow really this buggy, and what could be a workaround for that? The only way I could think of, is to build my own filter, put it into the codec chain manually and count the audio frames passed. This and the framerate gives me the time. Is this the only way?

thanks for your help
RSE

JohnnyMalaria
18th October 2008, 20:12
Most likely it is a bug in the filter rather than DirectShow itself. What filter is it?

rse
18th October 2008, 20:37
For me it seems filter independent. It is the same behavior with my old version of ffdshow tryouts and the original mp3 filter which comes with XP.

But after more testing I now must renew my analysis: with only double speed, IMediaSeeking::GetCurrentPosition doesnīt yet report the end value when the media is actually at its end. With a higher speed (i.e. 5x) it reports maximum position before the media is actually at its end. You can try this on your own by downloading my player (see signature). It is only an exe-file which doesnīt need installation and it doesnīt write to registry nor to disk. If you donīt speak german here is the use: go to tab Geschwindigkeit and track the trackbar. The rest should be understandable language independent ;-).