媒体基础接收器写入器错误 E_NOINTERFACE (0x80004002)

Media Foundation Sink Writer error E_NOINTERFACE (0x80004002)

目标是:从网络摄像头录制视频(无音频)流原样,即不转码。

当前的实现是使用如下所示的简单拓扑(括号中的节点编号供阅读跟踪日志时参考):

[Source (0)] -> [Tee (1)] -> (auto-added Decoder (2)) -> [EVR (3)]
                          \-> [Sink Writer (4)]

使用 IMFMediaSession 处理拓扑解析(在通过解析 Activation 对象绑定 EVR 输出之后如 MSDN - binding outputs)

中所述

如果我根本不添加 Sink Writer - 会话工作正常,在指定的 window 中生成输出(视频预览)。无论是否存在 Tee 节点都有效(如预期)。

当我试图将 Sink Writer 合并到 Topology 时出现问题。

Sink Writer的初始化非常简单。基本上只有 MFCreateSinkWriterFromURL() 提供输出文件的名称和 IMFAttributes 指定 no converters with no hardware transforms plus 低延迟无节流转码容器类型被指定为MPEG4,但如果该参数是从文件扩展名推导出来的(.mp4).

创建 Sink Writer 后,将通过 AddStream() 将新流添加到其中,并且网络摄像头的 媒体类型 是直接用于指定输出的 媒体类型 以及 SetInputMediaType() 调用。

A BeginWriting() 被调用以完成 Sink Writer 的初始化,之后通过调用 SetObject() 将其添加到节点。

A Tee 然后将它的辅助输出连接到 Sink Writer 的节点并且拓扑被解析(成功)并且是大概准备好了。

一旦拓扑被排队到带有 MFSESSION_SETTOPOLOGY_NORESOLUTION 标志(以及 MFSESSION_SETTOPOLOGY_IMMEDIATE)的新创建的会话中,播放和录制应该开始 - 这是我目前对它应该如何理解工作。

然而这就是我通过 Invoke() 获得 媒体会话事件 事件类型 MESessionTopologySet 的地方,错误状态代码 0x80004002!

使用 Sink Writer 的属性(指定 empty/default 属性)没有产生积极的结果。在我添加编写器之前移动拓扑解析并没有改变任何东西。将 Tee 节点的 主输出流 指定为 EVR 也没有帮助。

禁用 MS 的 Red-Stone 功能并将 EnableFrameServerMode 设置为 0 没有帮助。

Windows 10 Pro 上构建和 运行 Windows SDK 10.0.10586桌面。


下面是来自 mftrace 的日志供参考(不得不 trim 一点以适应 30K 的限制):


PID, TID    Time (UTC)    TraceMessage
--------- --------------  ------------
...... removed the beginning to save space
8000,2ED0 21:51:35.64241 CMFPlatExportDetours::MFStartup @ Version=0x00020070, dwFlags=0x00000001
...... enumerating hardware and setting up client factories
8000,2ED0 21:51:35.65757 CMFPlatExportDetours::MFStartup @ Version=0x00020070, dwFlags=0x00000000
...... CoCreateInstance calls
8000,2ED0 21:51:35.66117 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New MFT @000001B0B3BE3590
8000,2ED0 21:51:35.66119 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New source @000001B0B3BEFB80
8000,2ED0 21:51:35.66123 CMFMediaSourceDetours::TracePD @000001B0B3BEFB80 Stream 0 (ID 0): selected 1, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:35.66150 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New MFT @000001B0B3BE3590
8000,2ED0 21:51:35.66150 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New source @000001B0B3BEFB80
8000,2ED0 21:51:35.66153 CMFMediaSourceDetours::TracePD @000001B0B3BEFB80 Stream 0 (ID 0): selected 1, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.33229 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New MFT @000001B0B3BE3590
8000,2ED0 21:51:38.33229 CMFActivateDetours::ActivateObject @000001B0B3BE3390 New source @000001B0B3BEFB80
8000,2ED0 21:51:38.33233 CMFMediaSourceDetours::TracePD @000001B0B3BEFB80 Stream 0 (ID 0): selected 1, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.33272 CMFReadWriteExportDetours::MFCreateSinkWriterFromURL @ URL: 'c:\tmp\rry-raw.mp4', bytestream @0000000000000000, MF_SINK_WRITER_DISABLE_THROTTLING=1;MF_TRANSCODE_CONTAINERTYPE=MFTranscodeContainerType_MPEG4;MF_READWRITE_DISABLE_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS=0
8000,2ED0 21:51:38.33289 COle32ExportDetours::CoCreateInstance @ Created {48E2ED0F-98C2-4A37-BED5-166312DDD83F} MFReadWrite Class Factory (C:\Windows\System32\mfreadwrite.dll) @000001B0B234EFA0 - traced interfaces: IMFReadWriteClassFactory @000001B0B234EFA0, 
8000,2ED0 21:51:38.33290 CMFReadWriteClassFactoryDetours::CreateInstanceFromURL @000001B0B234EFA0 URL: 'c:\tmp\rry-raw.mp4', MF_SINK_WRITER_DISABLE_THROTTLING=1;MF_TRANSCODE_CONTAINERTYPE=MFTranscodeContainerType_MPEG4;MF_READWRITE_DISABLE_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS=0
8000,2ED0 21:51:38.33292 CMFPlatExportDetours::MFCreateFile @ URL: 'c:\tmp\rry-raw.mp4'
8000,2ED0 21:51:38.33315 CMFReadWriteClassFactoryDetours::HandleObject @ New sink writer @000001B0B3C01770
8000,2ED0 21:51:38.33322 CMFSinkWriterDetours::AddStream @000001B0B3C01770 Stream Index 0x0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.33326 CMFSinkWriterDetours::SetInputMediaType @000001B0B3C01770 Stream Index 0x0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.33379 COle32ExportDetours::CoCreateInstance @ Created {A22C4FC7-6E91-4E1D-89E9-53B2667B72BA} MF MPEG4 Sink Class Factory (C:\Windows\System32\mfmp4srcsnk.dll) @000001B0B234EFA0 - traced interfaces: 
8000,2ED0 21:51:38.33423 CMFByteStreamDetours::GetCapabilities @000001B0B3BE0520 Capabilities 0x00000806
8000,2ED0 21:51:38.33434 CMFSinkWriterDetours::BeginWriting @000001B0B3C01770 Began writing
8000,2ED0 21:51:38.33538 COle32ExportDetours::CoCreateInstance @ New MFT @000001B0B3C24730, VIDEO_ZOOM_RECT=00 00 00 00 00 00 00 00 00 00 80 3f 00 00 80 3f 
8000,2ED0 21:51:38.33539 COle32ExportDetours::CoCreateInstance @ Created {E474E05A-AB65-4F6A-827C-218B1BAAF31F} MF Video Mixer (C:\Windows\System32\evr.dll) @000001B0B3C24730 - traced interfaces: IMFTransform @000001B0B3C24730, 
8000,2ED0 21:51:38.38105 COle32ExportDetours::CoCreateInstance @ Created {A0A7A57B-59B2-4919-A694-ADD0A526C373} Tearless Window Presenter (C:\Windows\System32\evr.dll) @000001B0B3C292E8 - traced interfaces: 
8000,2ED0 21:51:38.38107 COle32ExportDetours::CoCreateInstance @ Created {98455561-5136-4D28-AB08-4CEE40EA2781} MF Video Presenter (C:\Windows\System32\evr.dll) @000001B0B3C27390 - traced interfaces: 
8000,2ED0 21:51:38.38111 CMFTransformDetours::ProcessMessage @000001B0B3C24730 Message type=0x00000002 MFT_MESSAGE_SET_D3D_MANAGER, param=B3C28090
8000,2ED0 21:51:38.39477 CMFActivateDetours::ActivateObject @000001B0B3C00430 New sink @000001B0B3C29950
8000,2ED0 21:51:38.39477 CMFMediaSinkDetours::Attach @000001B0B3C29950 Clock state @000001B0B3C29970
8000,2ED0 21:51:38.40944 CMFTransformDetours::SetInputType @000001B0B3C24730 Succeeded MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.40952 CMFTransformDetours::SetInputType @000001B0B3C2B0F0 Succeeded MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.40986 CMFTransformDetours::SetInputType @000001B0B3C24730 Succeeded MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.40988 CMFTransformDetours::SetOutputType @000001B0B3C2B0F0 Succeeded MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
...... attach clock and rate control
8000,2ED0 21:51:38.41105 CTopologyHelpers::Trace @000001B0B3C2A8E0 >>>>>>>>>>>>> input topology
8000,2ED0 21:51:38.41106 CTopologyHelpers::TraceNode @ Node 0 @000001B0B3C00430 ID:1F4000000001, 0 inputs, 1 outputs, type 1, MF_TOPONODE_MARKIN_HERE=1;MF_TOPONODE_MARKOUT_HERE=1;MF_TOPONODE_MEDIASTART=0 (0,0);MF_TOPONODE_SOURCE=@000001B0B3BEFB80;MF_TOPONODE_PRESENTATION_DESCRIPTOR=@000001B0B3BF45A0;MF_TOPONODE_STREAM_DESCRIPTOR=@000001B0B3BF4170
8000,2ED0 21:51:38.41107 CTopologyHelpers::TraceObject @ Source @000001B0B3BEFB80 {00000000-0000-0000-0000-000000000000} (C:\Windows\SYSTEM32\MFCORE.DLL), MFMEDIASOURCE_CHARACTERISTICS=0x00000005
8000,2ED0 21:51:38.41109 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2B030 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41109 CTopologyHelpers::TraceNode @ Node 1 @000001B0B3C2B030 ID:1F4000000003, 1 inputs, 2 outputs, type 3, MF_TOPONODE_PRIMARYOUTPUT=0
8000,2ED0 21:51:38.41109 CTopologyHelpers::TraceObject @ Tee @0000000000000000 {00000000-0000-0000-0000-000000000000} ((null)), (null)
8000,2ED0 21:51:38.41111 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C00430 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41112 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2ADB0 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41114 CTopologyHelpers::TraceStream @ Output stream 1, connected to node @000001B0B3C29130 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41115 CTopologyHelpers::TraceNode @ Node 2 @000001B0B3C2ACF0 ID:1F4000000002, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0;MF_TOPONODE_TRANSFORM_OBJECTID={D23E6477-B104-4707-81CB-E1CA19A07016};{B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}=@000001B0B3C27370
8000,2ED0 21:51:38.41115 CTopologyHelpers::TraceObject @ Sink @000001B0B3C2A048 {D23E6477-B104-4707-81CB-E1CA19A07016} (C:\Windows\SYSTEM32\MF.dll), (null)
8000,2ED0 21:51:38.41115 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2ADB0 stream 0, MT: >
8000,2ED0 21:51:38.41116 CTopologyHelpers::TraceNode @ Node 3 @000001B0B3C2ADB0 ID:1F4000000008, 1 inputs, 1 outputs, type 2, MF_TOPONODE_TRANSFORM_OBJECTID={CF862982-23B0-4E3D-8C76-D03FEF084AF8}
8000,2ED0 21:51:38.41116 CTopologyHelpers::TraceObject @ MFT @000001B0B3C2B0F0 {CF862982-23B0-4E3D-8C76-D03FEF084AF8} (C:\Windows\SYSTEM32\MFCORE.DLL), MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE=1
8000,2ED0 21:51:38.41118 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2B030 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41120 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2ACF0 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,2ED0 21:51:38.41120 CTopologyHelpers::TraceNode @ Node 4 @000001B0B3C29130 ID:1F4000000004, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0
8000,2ED0 21:51:38.41120 CMFTopologyNodeDetours::GetGUID @000001B0B3C29130 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
8000,2ED0 21:51:38.41121 CTopologyHelpers::TraceObject @ UnknownType @0000000000000000 {00000000-0000-0000-0000-000000000000} ((null)), (null)
8000,2ED0 21:51:38.41121 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2B030 stream 1, MT: >
8000,2ED0 21:51:38.41121 CTopologyHelpers::Trace @000001B0B3C2A8E0 MF_TOPOLOGY_RESOLUTION_STATUS = 0
8000,2ED0 21:51:38.41121 CTopologyHelpers::Trace @000001B0B3C2A8E0 >>>>>>>>>>>> queued topology
8000,229C 21:51:38.41144 CTopologyHelpers::TraceNode @ Node 0 @000001B0B3C00430 ID:1F4000000001, 0 inputs, 1 outputs, type 1, MF_TOPONODE_MARKIN_HERE=1;MF_TOPONODE_MARKOUT_HERE=1;MF_TOPONODE_MEDIASTART=0 (0,0);MF_TOPONODE_SOURCE=@000001B0B3BEFB80;MF_TOPONODE_PRESENTATION_DESCRIPTOR=@000001B0B3BF45A0;MF_TOPONODE_STREAM_DESCRIPTOR=@000001B0B3BF4170;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1
8000,229C 21:51:38.41145 CTopologyHelpers::TraceObject @ Source @000001B0B3BEFB80 {00000000-0000-0000-0000-000000000000} (C:\Windows\SYSTEM32\MFCORE.DLL), MFMEDIASOURCE_CHARACTERISTICS=0x00000005
8000,229C 21:51:38.41147 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2B030 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41147 CTopologyHelpers::TraceNode @ Node 1 @000001B0B3C2B030 ID:1F4000000003, 1 inputs, 2 outputs, type 3, MF_TOPONODE_PRIMARYOUTPUT=0;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1
8000,229C 21:51:38.41148 CTopologyHelpers::TraceObject @ Tee @0000000000000000 {00000000-0000-0000-0000-000000000000} ((null)), (null)
8000,229C 21:51:38.41149 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C00430 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41151 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2ADB0 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41152 CTopologyHelpers::TraceStream @ Output stream 1, connected to node @000001B0B3C29130 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41153 CTopologyHelpers::TraceNode @ Node 2 @000001B0B3C2ACF0 ID:1F4000000002, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0;MF_TOPONODE_TRANSFORM_OBJECTID={D23E6477-B104-4707-81CB-E1CA19A07016};{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;{B8AA3129-DFC9-423A-8ACD-1D82850A3D1F}=@000001B0B3C27370
8000,229C 21:51:38.41153 CTopologyHelpers::TraceObject @ Sink @000001B0B3C2A048 {D23E6477-B104-4707-81CB-E1CA19A07016} (C:\Windows\SYSTEM32\MF.dll), (null)
8000,229C 21:51:38.41153 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2ADB0 stream 0, MT: >
8000,229C 21:51:38.41154 CTopologyHelpers::TraceNode @ Node 3 @000001B0B3C2ADB0 ID:1F4000000008, 1 inputs, 1 outputs, type 2, MF_TOPONODE_TRANSFORM_OBJECTID={CF862982-23B0-4E3D-8C76-D03FEF084AF8};{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1
8000,229C 21:51:38.41155 CTopologyHelpers::TraceObject @ MFT @000001B0B3C2B0F0 {CF862982-23B0-4E3D-8C76-D03FEF084AF8} (C:\Windows\SYSTEM32\MFCORE.DLL), MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1
8000,229C 21:51:38.41156 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2B030 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41158 CTopologyHelpers::TraceStream @ Output stream 0, connected to node @000001B0B3C2ACF0 stream 0, MT: MF_MT_FRAME_SIZE=1374389534960 (320,240);MF_MT_AVG_BITRATE=36864000;MF_MT_YUV_MATRIX=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_VIDEO_LIGHTING=3;MF_MT_DEFAULT_STRIDE=640;MF_MT_VIDEO_CHROMA_SITING=6;MF_MT_AM_FORMAT_TYPE=FORMAT_VIDEOINFO2;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_VIDEO_NOMINAL_RANGE=2;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_FRAME_RATE_RANGE_MIN=128849018881 (30,1);MF_MT_SAMPLE_SIZE=153600;MF_MT_VIDEO_PRIMARIES=2;MF_MT_INTERLACE_MODE=2;MF_MT_FRAME_RATE_RANGE_MAX=128849018881 (30,1);MF_MT_SUBTYPE=MFVideoFormat_YUY2
8000,229C 21:51:38.41159 CTopologyHelpers::TraceNode @ Node 4 @000001B0B3C29130 ID:1F4000000004, 1 inputs, 0 outputs, type 0, MF_TOPONODE_STREAMID=0;MF_TOPONODE_NOSHUTDOWN_ON_REMOVE=0;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1
8000,229C 21:51:38.41159 CMFTopologyNodeDetours::GetGUID @000001B0B3C29130 attribute not found guidKey = MF_TOPONODE_TRANSFORM_OBJECTID
8000,229C 21:51:38.41159 CTopologyHelpers::TraceObject @ UnknownType @0000000000000000 {00000000-0000-0000-0000-000000000000} ((null)), (null)
8000,229C 21:51:38.41159 CTopologyHelpers::TraceStream @ Input stream 0, connected to node @000001B0B3C2B030 stream 1, MT: >
8000,229C 21:51:38.41159 CTopologyHelpers::Trace @000001B0B3C2A8E0 MF_TOPOLOGY_RESOLUTION_STATUS = 0
8000,229C 21:51:38.41159 CTopologyHelpers::Trace @000001B0B3C2A8E0 

Sink Writer 不是要为 Output Node 指定的有效对象。仅有的两个有效对象是 IMFStreamSinkIMFActivate.

一旦 IMFStreamSink 被正确创建和配置,其他一切就开始正常工作了。

创建要在节点的 SetObject() 调用中使用的 IMFStreamSink 的步骤:

  1. 创建IMFByteStream(例如通过MFCreateFile()
  2. 基于 IMFByteStream 创建 IMFMediaSink 并设置它(在 MSDN 中描述)
  3. 使用 GetStreamSinkById() 获取 IMFStreamSink 对象 - 这是在节点的 SetObject() 调用中使用的对象!