This is presumably a bug in Windows Media Video 9 Encoder in versions up to Windows 7 included (fixed in Windows 8.1 at the very least – wmvencod.dll 6.3.9600.17415).
IMediaObject::Discontinuity call destroys input the DMO it already holds: it reports success, and handles discontinuity correctly. It even drains output as it should, but if in the same time it already has input to process – this input is gone and the typical outcome is that a frame (or possibly more?) in the end of the stream is trimmed away.
The call itself is legal and reports
S_OK. The method should have returned
DMO_E_NOTACCEPTING if it is too early to report discontinuity, and the DMO does not do it.
Good news it’s fixed in its most recent version and it is not a cold case.