WMF EVR 停止将 MEStreamSinkRequestSample 事件发送到实时流中约 7 秒

WMF EVR stops sending MEStreamSinkRequestSample event ~7 seconds into the live stream

我正在编写 WMF 自定义媒体源。 此源从 RTSP 流(使用 FFMPeg 4.1)获取 h264 数据包,并将它们发送到解码器并使用 EVR 将它们渲染到屏幕上。它还将它们发送到编码器和文件编写器

前 ~7 秒的视频看起来不错 约 7 秒后,FPS 从约 30 变为约 2,EVR 将旧图像显示为伪像(显示它而不是丢失的帧)。 录制的视频看起来不错。

运行 MFTrace 我发现渲染器停止发送 MEStreamSinkRequestSample,因此有数据要发送的源(并像以前一样引发 MEMediaSample)不会发送样本。 样本只到达解码器的 ProcessInput,我看不到 ProcessOutput 调用。 根据我的日志,没有 B 帧(pts == dts)并且两者都是单调的,具有正常的时间戳

这些是到达 EVR 的最后一帧的日志行

    Line 149066: 552,1AA8 13:03:30.50129 CMFSourceReaderCallbackDetours::OnReadSample @0000027792F818B0 Stream index 0x0 Sample @000002779DB2FF80, Time 7266ms, Duration 33ms, Buffers 1, Size 620B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=72666778 (0,72666778);MFSampleExtension_Token=@000002779DB1FA60;MFSampleExtension_DeviceTimestamp=72666778 (0,72666778);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0
    Line 149100: 552,3F90 13:03:30.50182 CMFMediaStreamDetours::HandleEvent @0000027792FF7930 Sample @000002779DB2FF80, Time 7266ms, Duration 33ms, Buffers 1, Size 620B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=72666778 (0,72666778);MFSampleExtension_Token=@000002779DB1FA60;MFSampleExtension_DeviceTimestamp=72666778 (0,72666778);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0
    Line 149174: 552,3F90 13:03:30.50210 CMFTransformDetours::ProcessInput @0000027790451EE0 Stream ID 0, Sample @000002779DB2FF80, Time 7266ms, Duration 33ms, Buffers 1, Size 620B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=72666778 (0,72666778);MFSampleExtension_Token=@000002779DB1FA60;MFSampleExtension_DeviceTimestamp=72666778 (0,72666778);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0
    Line 166573: 552,A50 13:03:31.60248 CMFTransformDetours::ProcessOutput @0000027790451EE0 Stream ID 0, Sample @000002779DB2F980, Time 7266ms, Duration 33ms, Buffers 1, Size 1382400B, {19124E7C-AD4B-465F-BB18-20186287B6AF}=;{424C754C-97C8-48D6-8777-FC41F7B60879}=@0000000000000000;{79EA74DF-A740-445B-BC98-C9ED1F260EEE}=0;MFSampleExtension_CleanPoint=1;MFSampleExtension_Discontinuity=0;MFSampleExtension_Interlaced=0;{B4DD4A8C-0BEB-44C4-8B75-B02B913B04F0}=0
    Line 166728: 552,A50 13:03:31.60276 CMFTransformDetours::ProcessInput @000002779041B330 Stream ID 0, Sample @000002779DB2F980, Time 7266ms, Duration 33ms, Buffers 1, Size 1382400B, {19124E7C-AD4B-465F-BB18-20186287B6AF}=;{424C754C-97C8-48D6-8777-FC41F7B60879}=@0000000000000000;{73A954D4-09E2-4861-BEFC-94BD97C08E6E}=83666778 (0,83666778);{79EA74DF-A740-445B-BC98-C9ED1F260EEE}=0;MFSampleExtension_Token=@0000000000000000;MFSampleExtension_DeviceTimestamp=83666778 (0,83666778);MFSampleExtension_CleanPoint=1;MFSampleExtension_Discontinuity=0;MFSampleExtension_Interlaced=0;{B4DD4A8C-0BEB-44C4-8B75-B02B913B04F0}=0
    Line 166853: 552,A50 13:03:31.60482 CMFTransformDetours::ProcessOutput @000002779041B330 Stream ID 0, Sample @000002779DB25BC0, Time 7266ms, Duration 33ms, Buffers 1, Size 1843200B, MFSampleExtension_CleanPoint=1;MFSampleExtension_Interlaced=0
    Line 166905: 552,A50 13:03:31.60500 CMFStreamSinkDetours::ProcessSample @000002779045A878 Sample @000002779DB25BC0, Time 7266ms, Duration 33ms, Buffers 1, Size 1843200B, {19124E7C-AD4B-465F-BB18-20186287B6AF}=;{424C754C-97C8-48D6-8777-FC41F7B60879}=@0000000000000000;{73A954D4-09E2-4861-BEFC-94BD97C08E6E}=83666778 (0,83666778);{79EA74DF-A740-445B-BC98-C9ED1F260EEE}=0;MFSampleExtension_Token=@000002779DB1F6A0;MFSampleExtension_DeviceTimestamp=83666778 (0,83666778);MFSampleExtension_CleanPoint=1;MFSampleExtension_Discontinuity=0;MFSampleExtension_Interlaced=0;{B4DD4A8C-0BEB-44C4-8B75-B02B913B04F0}=0
    Line 166909: 552,A50 13:03:31.60503 CMFTransformDetours::ProcessInput @0000027790455960 Stream ID 0, Sample @000002779DB25BC0, Time 7266ms, Duration 33ms, Buffers 1, Size 1843200B, {19124E7C-AD4B-465F-BB18-20186287B6AF}=;{424C754C-97C8-48D6-8777-FC41F7B60879}=@0000000000000000;{73A954D4-09E2-4861-BEFC-94BD97C08E6E}=83666778 (0,83666778);{79EA74DF-A740-445B-BC98-C9ED1F260EEE}=0;MFSampleExtension_Token=@000002779DB1F6A0;MFSampleExtension_DeviceTimestamp=83666778 (0,83666778);MFSampleExtension_CleanPoint=1;MFSampleExtension_Discontinuity=0;MFSampleExtension_Interlaced=0;{B4DD4A8C-0BEB-44C4-8B75-B02B913B04F0}=0
    Line 166918: 552,A50 13:03:31.60510 CMFTransformDetours::ProcessOutput @0000027790455960 Stream ID 0, Sample @000002779045EF00, Time 7266ms, Duration 33ms, Buffers 1, Size 409920B, , Duration 33ms, Buffers 1, Size 409920B,

还有以解码器结尾的日志行

    Line 149726: 552,260 13:03:30.53399 CMFSourceReaderCallbackDetours::OnReadSample @0000027792F818B0 Stream index 0x0 Sample @000002779DB2F500, Time 7300ms, Duration 33ms, Buffers 1, Size 662B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=73000000 (0,73000000);MFSampleExtension_Token=@000002779DB1F640;MFSampleExtension_DeviceTimestamp=73000000 (0,73000000);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0
    Line 149760: 552,3F90 13:03:30.53446 CMFMediaStreamDetours::HandleEvent @0000027792FF7930 Sample @000002779DB2F500, Time 7300ms, Duration 33ms, Buffers 1, Size 662B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=73000000 (0,73000000);MFSampleExtension_Token=@000002779DB1F640;MFSampleExtension_DeviceTimestamp=73000000 (0,73000000);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0
    Line 149834: 552,3F90 13:03:30.53471 CMFTransformDetours::ProcessInput @0000027790451EE0 Stream ID 0, Sample @000002779DB2F500, Time 7300ms, Duration 33ms, Buffers 1, Size 662B, {73A954D4-09E2-4861-BEFC-94BD97C08E6E}=73000000 (0,73000000);MFSampleExtension_Token=@000002779DB1F640;MFSampleExtension_DeviceTimestamp=73000000 (0,73000000);MFSampleExtension_CleanPoint=0;MFSampleExtension_Interlaced=0  

MFTrace 事件(过滤掉“Met=”)MEStreamSinkRequestSample= 305 MEMediaSample= 213

Line 151717: 552,3F90 13:03:30.63479 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F680, 
Line 152202: 552,3F90 13:03:30.63838 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 152377: 552,3F90 13:03:30.66791 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F5C0, 
Line 152862: 552,3F90 13:03:30.67133 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 153037: 552,3F90 13:03:30.70149 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB30280, 
Line 153522: 552,3F90 13:03:30.70538 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 153697: 552,2DD4 13:03:30.73484 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 154182: 552,2DD4 13:03:30.73861 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 154357: 552,3F90 13:03:30.76793 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FD40, 
Line 154842: 552,3F90 13:03:30.77171 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 155017: 552,3CE4 13:03:30.80114 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FC80, 
Line 155502: 552,3CE4 13:03:30.80453 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 155677: 552,3CE4 13:03:30.83483 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FF80, 
Line 156162: 552,3CE4 13:03:30.83832 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 156337: 552,A50 13:03:30.86834 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F500, 
Line 156822: 552,A50 13:03:30.87180 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 156997: 552,3CE4 13:03:30.90157 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FB00, 
Line 157482: 552,3CE4 13:03:30.90504 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 157657: 552,3CE4 13:03:30.93457 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @0000027790460240, 
Line 158142: 552,3CE4 13:03:30.93822 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 158317: 552,3CE4 13:03:30.96831 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F680, 
Line 158802: 552,3CE4 13:03:30.97161 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 158977: 552,2DD4 13:03:31.00100 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F5C0, 
Line 159462: 552,2DD4 13:03:31.00419 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 159637: 552,2DD4 13:03:31.03442 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB30280, 
Line 160122: 552,2DD4 13:03:31.03824 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 160297: 552,2DD4 13:03:31.06790 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 160930: 552,2DD4 13:03:31.07260 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 161105: 552,A50 13:03:31.10179 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 161443: 552,A50 13:03:31.13445 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 161781: 552,A50 13:03:31.16811 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 162119: 552,A50 13:03:31.19194 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 162457: 552,A50 13:03:31.23510 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 162795: 552,A50 13:03:31.26862 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 163133: 552,A50 13:03:31.30162 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 163463: 552,A50 13:03:31.33445 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FD40, 
Line 163781: 552,A50 13:03:31.36811 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB30280, 
Line 164099: 552,A50 13:03:31.40173 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F5C0, 
Line 164417: 552,A50 13:03:31.43510 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F680, 
Line 164735: 552,A50 13:03:31.46827 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @0000027790460240, 
Line 165053: 552,A50 13:03:31.50162 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FB00, 
Line 165371: 552,A50 13:03:31.53487 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F500, 
Line 165689: 552,A50 13:03:31.56838 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FF80, 
Line 166174: 552,A50 13:03:31.57268 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 166349: 552,A50 13:03:31.60165 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FC80, 
Line 166934: 552,A50 13:03:31.60533 CMFStreamSinkDetours::EndGetEvent @000002779045A878 Met=305 (null), value (empty), 
Line 167109: 552,3CE4 13:03:31.63434 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2F980, 
Line 167427: 552,3CE4 13:03:31.66812 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @000002779DB2FB00, 
Line 167745: 552,3CE4 13:03:31.70109 CMFMediaStreamDetours::EndGetEvent @0000027792FF7930 Met=213 (null), value @0000027790460240,

如果您认为需要更多数据,并且可以指导我在那个方向评论问题,我会尽快添加它并带有编辑标题。

我试图解决该问题的想法之一是使用 ffmpeg 进行解码,并将未压缩的图像 (I420) 传递给媒体基础。 这为我解决了这个问题。 由此我得出结论,问题出在 h264 解码器上,它不能很好地处理直播。