Why do i not get a KSSTATE_STOP in my SetState function?

Hi there,
I have a driver which acts as a virtual audio device. If selected as the playback device, it performs some processing on any audio before passing it on and playing it out the physical sound device.

I have a problem which I am sure is to do with my newbiness in this area. Any tips would be greatly appreciated. The problem is this:

If I am using Windows Media Player to play a file, and then I seek to a future position in the file and then press stop, I never receive a KSSTATE_STOP notification in my IMiniportWaveCyclicStream::SetState function - in fact this function is never called again until I actually shutdown WMP. This problem only occurs after I have done a seek and only in WMP - all other audio players I have tried send me states I am expecting.

In my driver I use this notification to signal the thread I have reading from the DMA channel to stop reading and shutdown. Without the notification it goes into an eternal loop and I enter BSOD land.

So, some questions I have are

  1. which component of the audio process is responsible for calling the SetState function?
  2. why might seeking in WMP cause SetState to not be called?

Thanks,
Ben

On Sun, Oct 21, 2007 at 08:43:31PM -0400, xxxxx@nchsoftware.com wrote:

Hi there,
I have a driver which acts as a virtual audio device. If selected as
the playback device, it performs some processing on any audio before
passing it on and playing it out the physical sound device.

If I am using Windows Media Player to play a file, and then I seek
to a future position in the file and then press stop, I never receive
a KSSTATE_STOP notification in my IMiniportWaveCyclicStream::SetState
function - in fact this function is never called again until I actually
shutdown WMP. This problem only occurs after I have done a seek and
only in WMP - all other audio players I have tried send me states I
am expecting.

In my driver I use this notification to signal the thread I have
reading from the DMA channel to stop reading and shutdown. Without the
notification it goes into an eternal loop and I enter BSOD land.

So, some questions I have are

  1. which component of the audio process is responsible for calling the
    SetState function?
  2. why might seeking in WMP cause SetState to not be called?

Are you daying it doesn’t even change you to KSSTATE_PAUSE? Are you
still getting streaming requests?

Tim Roberts, xxxxx@probo.com
Providenza & Boeklheide, Inc.

That’s right - no change of state at all. Once the player has stopped there are no further calls to the CopyTo function.

I have noticed that my IDmaChannel::GetPosition() function is still being called once I have stopped the player. Is it possible I am reporting the wrong buffer position here? Would this explain the behaviour?

Thanks,
Ben

I have a couple of developments on this issue which I am yet to resolve. The problem, in a nutshell, is now:

When playing an audio file with Windows Media Player and the player is stopped within 21 seconds from the end of the file, my miniport driver never receives any KSSTATE notifications. The port driver just stays in KSSTATE_RUN and keeps calling GetPosition forever.

Once I actually shutdown Windows Media Player, I finally get the PAUSE -> ACQUIRE -> STOP.

If I stop 22 seconds or more before the end then everything works fine. No matter what file I use, regardless of length, sample rate, bit rate or channels, the result is always the same.

I am baffled! Does anyone have any ideas as to where I could look next?
Thanks,
Ben