Nikolay Sivov (@nsivov) commented about dlls/mfmediaengine/main.c:
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ENDED, 0, 0); break;
case MEEndOfPresentation:
video_frame_sink_notify_end_of_presentation(engine->presentation.frame_sink);
break;
I think you can use MFSTREAMSINK_MARKER_ENDOFSEGMENT for this. The way you did it sort of bypasses normal session flow, there is potentially unknown number of pending samples in the pipeline once MEEndOfPresentation is received. This is only a problem if for some reason earlier node somehow requests more times than the sink. ENDOFSEGMENT is already used in EVR, and that seems to work.