On Thu Sep 4 11:07:06 2025 +0000, Nikolay Sivov wrote:
In my opinion the way this is tested is too high level. It's of course fine to test what topology resolution produces, and initial media source types. But if you only compare before and after session state change, there is no way to see from such test where this type change happened. Does it mean source type changes once source is started, or H.264 decoder changes types on its own or in response to source type change? Does this break application assumptions on output buffer sizes?
By wrapping the transform, sink and sink media type handler I found the type switch occurs after the transform has processed some samples. It always occurs before the first sample is sent to the sink. The session engine calls `GetOutputAvailableType()` on the transform, and then with the new type it calls `SetOutputType()` on the transform and `SetCurrentMediaType()` on the sink type handler. This happens for H.264 even for aligned sizes, but it is not done for WMV.
It may be possible to define the sequence of events more completely by wrapping the `IMFMediaSession`, but I think that's unnecessary and would be complicated. Applications must depend for their sequencing on the same events used in this test, so it's unlikely any will break on a subtle difference. It should suffice to update the type before the sink receives the first sample and also before `MESessionStarted`.
I also tested `MESessionTopologyStatus/MF_TOPOSTATUS_STARTED_SOURCE` which showed the change occurs after that. That's the last event before `MESessionStarted`. I will be adding that test to the MR. I'm not planning to include the wrapped transform, since we need only check for sample delivery to the grabber. I'll add a test for that.
Do you have suggestions for other tests?