@Jeanine Zhang-MSFT . I made a mistake in my example. Certainly the values 11025 or 22050 are the values of nSamplesPerSec (not bits per sample), but it does not matter which parameter of audio stream was changed - any of them could be changed. I was advised to call QueryAccept or DynamicQueryAccept, but both failed when my graph was not stopped. It seems to be the only solution - to stop the graph and reconnect the pins.
Developing Directshow source filter
I have created (C++, Win10, VS2022) a simple source DirectShow filter. It’s purpose is to read audio stream from the external source (file – for testing, network – in future). It has one output pin, which I connect to soundspeaker.
In order to do it I have implemented FillBuffer method for an output pin of the filter. Media type - MEDIATYPE_Stream/MEDIASUBTYPE_PCM.
Before being connected the pin gets info about media type via SetMediaType (WAVEFORMATEX) and remembers it (wBitsPerSample; nSamplesPerSec; nChannels). Audio stream comes from the external source (file.net) to FillBuffer with (wBitsPerSample; nSamplesPerSec; nChannels)
Could you help me – which actions and calls should I make in FillBuffer() method if I will receive audio stream with changed wBitsPerSample or nSamplesPerSec or nChannels ?
The fact is that these parameters have already been agreed between my pin and the input pin of the soundspeaker and I need to change these agreement correctly.