I wrote custom Asynchronous Direct3D-Aware MFT video decoder. After registering it works correctly in my application based on IMFMediaSession and in WM Player. But I faced with unresolved issue.I get a deadlock, if I do the following
1) Start Windows Media Player
2) Open any video file with appropriate encoding
3) Turn repeat on
4) Play file and wait when it start repeat (it doesn’t matter once ore many times)
5) Try to seek playing (doesn’t matter backward or forward)
Player stops playing and there is no chance to repair it except restarting it.
If I don’t turn on repeat option in WMP or make seek operation before the very first repeat, everything works properly.
Researching debug logs and MFTrace.exe logs I discovered the following:
When I try to seek BEFORE play repeat I see
16980,219C 11:47:59.12676 CMFTransformDetours::ProcessMessage @09B5D878 Message type=0x00000000 MFT_MESSAGE_COMMAND_FLUSH, param=00000000
....
16980,46FC 11:47:59.13065 CMFTransformDetours::ProcessMessage @09B5D878 Message type=0x10000001 MFT_MESSAGE_NOTIFY_END_STREAMING, param=00000000
....
16980,4864 11:47:59.13077 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::OnCommand (begin): cmds.size=2 cmd.back.kind=0
16980,4864 11:47:59.13082 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::Command::OnStart: time_ns=6627226800 time[sec]=6.62723
16980,4864 11:47:59.13086 CMFByteStreamDetours::Seek @07AFB598 Seeked to (origin 0x00000000, offset 0B, flags 0x00000001), new current position 0B
16980,4864 11:47:59.13088 CKernel32ExportDetours::OutputDebugStringA @ MkvReader::Seek: called pStream->Seek; hr=0x0; pos=0; curr_pos=0
16980,4864 11:47:59.13097 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::OnCommand (end): cmds.size=1 cancel=true
16980,3C78 11:47:59.13101 CMFMediaSourceDetours::EndGetEvent @053142A8 Met=206 (null), value @0531A718,
16980,219C 11:47:59.13103 CMFMediaStreamDetours::EndGetEvent @0531A718 Met=202 MEStreamStarted, value 66272268,
16980,3C78 11:47:59.13104 CMFMediaSourceDetours::EndGetEvent @053142A8 Met=201 (null), value 66272268,
....
16980,219C 11:47:59.13207 CMFMediaSourceDetours::EndGetEvent @05F73C38 Met=206 (null), value @05F15AF0,
16980,219C 11:47:59.13207 CMFQualityManagerDetours::NotifyQualityEvent @07B09448 Object=0x05F73C38 Event=0x0AD7C5E0 Type=206
16980,219C 11:47:59.13209 CMFMediaSourceDetours::EndGetEvent @05F73C38 Met=203 MESourceSeeked, value 66272268,
16980,46FC 11:47:59.13212 CMFMediaStreamDetours::EndGetEvent @05F15AF0 Met=204 (null), value 66272268,
....
16980,46FC 11:47:59.13247 CMFTransformDetours::ProcessMessage @09B5D878 Message type=0x10000003 MFT_MESSAGE_NOTIFY_START_OF_STREAM, param=00000000
And the same log AFTER first repeat
16856,124C 11:54:08.90724 CMFTransformDetours::ProcessMessage @08F1D878 Message type=0x00000000 MFT_MESSAGE_COMMAND_FLUSH, param=00000000
....
16856,39E0 11:54:08.91148 CMFTransformDetours::ProcessMessage @08F1D878 Message type=0x10000001 MFT_MESSAGE_NOTIFY_END_STREAMING, param=00000000
....
16856,43CC 11:54:08.91162 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::OnCommand (begin): cmds.size=2 cmd.back.kind=0
16856,43CC 11:54:08.91168 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::Command::OnStart: time_ns=7919327700 time[sec]=7.91933
16856,43CC 11:54:08.91173 CMFByteStreamDetours::Seek @0B0FD2F8 Seeked to (origin 0x00000000, offset 0B, flags 0x00000001), new current position 0B
16856,43CC 11:54:08.91175 CKernel32ExportDetours::OutputDebugStringA @ MkvReader::Seek: called pStream->Seek; hr=0x0; pos=0; curr_pos=0
16856,43CC 11:54:08.91180 CKernel32ExportDetours::OutputDebugStringA @ WebmMfSource::OnCommand (end): cmds.size=1 cancel=true
16856,1FB4 11:54:08.91184 CMFMediaSourceDetours::EndGetEvent @0535A4B8 Met=206 (null), value @0535A8D0,
16856,124C 11:54:08.91187 CMFMediaStreamDetours::EndGetEvent @0535A8D0 Met=202 MEStreamStarted, value 79193277,
16856,1FB4 11:54:08.91189 CMFMediaSourceDetours::EndGetEvent @0535A4B8 Met=201 (null), value 79193277,
....
16856,124C 11:54:08.91294 CMFMediaSourceDetours::EndGetEvent @07490CE0 Met=206 (null), value @0BD74AA0,
16856,124C 11:54:08.91295 CMFQualityManagerDetours::NotifyQualityEvent @07497010 Object=0x07490CE0 Event=0x0BDEA848 Type=206
16856,124C 11:54:08.91297 CMFMediaSourceDetours::EndGetEvent @07490CE0 Met=203 MESourceSeeked, value 79193277,
16856,39E0 11:54:08.91300 CMFMediaStreamDetours::EndGetEvent @0BD74AA0 Met=204 (null), value 79193277,
....
16856,1FB4 11:54:08.91357 CMFTransformDetours::ProcessMessage @07B30264 Message type=0x00000000 MFT_MESSAGE_COMMAND_FLUSH, param=00000000
16856,1FB4 11:54:08.91396 CMFPresentationClockDetours::GetTime @07496E90 Time 39296461hns
16856,1FB4 11:54:09.91465 CMFPresentationClockDetours::GetTime @07496E90 Time 49303350hns
In first case Media Foundation framework sends message MFT_MESSAGE_NOTIFY_START_OF_STREAM and player starts playing again. But in second case framework sends MFT_MESSAGE_COMMAND_FLUSHmessageinstead and player dies forever.
Did anybody meet with such behavior?