Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows IMFMediaSink无法在装有AMD GPU的PC上添加第二个音频输出流_Windows_Audio_Mp4_Ms Media Foundation - Fatal编程技术网

Windows IMFMediaSink无法在装有AMD GPU的PC上添加第二个音频输出流

Windows IMFMediaSink无法在装有AMD GPU的PC上添加第二个音频输出流,windows,audio,mp4,ms-media-foundation,Windows,Audio,Mp4,Ms Media Foundation,我正在尝试创建一个MP4 IMFMediaSink,并添加两个音频输入(pcm)编码,以便在我的MP4文件中有两个音频AAC曲目 这适用于安装了Intel或NVidia GPU的PC。音频从PCM编码到AAC,在两个音频层中都能正常播放 在装有AMD GPU(在我的例子中是R9)的PC机上,当我尝试添加第二个音频输出流时,会出现一个错误 这个错误没有告诉我多少: “请求在当前状态下无效。” 我的AAC音频媒体类型设置如下: hr = MFCreateMediaType(&pMedi

我正在尝试创建一个MP4 IMFMediaSink,并添加两个音频输入(pcm)编码,以便在我的MP4文件中有两个音频AAC曲目

这适用于安装了Intel或NVidia GPU的PC。音频从PCM编码到AAC,在两个音频层中都能正常播放

在装有AMD GPU(在我的例子中是R9)的PC机上,当我尝试添加第二个音频输出流时,会出现一个错误

这个错误没有告诉我多少:

“请求在当前状态下无效。”

我的AAC音频媒体类型设置如下:

   hr = MFCreateMediaType(&pMediaType);

   hr = pMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
   hr = pMediaType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_AAC);
   hr = pMediaType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, sampleBitSize);
   hr = pMediaType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, sampleRate);
   hr = pMediaType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, numChannels);
   hr = pMediaType->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, kAverageBytesPerSec);
   pMediaType->SetBlob(MF_MT_USER_DATA, userData, sizeof(userData));
对“AddStream()”的调用在我调用它的秒时失败:

   hr = pSinkWriter->AddStream(pOutputAudioMediaType, &audioLayerIdx);
我的SinkWriter使用以下属性初始化:

   MFCreateAttributes(&pAttributes, 2);
   pAttributes->SetUINT32(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0);
   pAttributes->SetUINT32(MF_LOW_LATENCY, 1);
   pAttributes->SetGUID(MF_TRANSCODE_CONTAINERTYPE, MFTranscodeContainerType_MPEG4);
   MFCreateSinkWriterFromURL(NULL, pWriteStream, pAttributes, &pSinkWriter);
有人提到过这个问题吗?知道我做错了什么吗

任何帮助都将不胜感激!我在这个问题上绞尽脑汁已经有一段时间了

MFTrace(很抱歉出现大转储):

5460,1BC 12:21:04.53040 CKERNEL2ExportDetours::OutputDebugStringA@******************************************************************************************************************111
5460,1BC 12:21:04.53043 CMFReadWriteExportDetours::MFCreateSinkWriterFromURL@URL:'.mp4',ByTestStream@00000268FDFBFE90,MF_TRANSCODE_CONTAINERTYPE=MFTranscode CONTAINERTYPE_MPEG4;MF_读写_禁用_转换器=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF\u读写\u启用\u硬件\u转换=0
5460,1BC 12:21:04.53054 COle32ExportDetours::CoCreateInstance@Created{48E2ED0F-98C2-4A37-BED5-166312DDD83F}MFReadWrite类工厂(C:\Windows\System32\MFReadWrite.dll)@00000268BA21BCC0-跟踪接口:IMFReadWriteClassFactory@00000268BA21BCC0,
5460,1BC 12:21:04.53055 CMFReadWriteClassFactoryDetours::CreateInstanceFromObject@00000268BA21BCC0 Object@00000268FDFBFE90,MF_TRANSCODE_CONTAINERTYPE=MFTranscode CONTAINERTYPE_MPEG4;MF_读写_禁用_转换器=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF\u读写\u启用\u硬件\u转换=0
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUnknown@00000268C75EDD30未找到属性guidKey=MF\u SINK\u WRITER\u ASYNC\u回调
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUINT32@00000268C75EDD30未找到属性guidKey=MF\u SINK\u WRITER\u DISABLE\u THROTTLING
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetUnknown@00000268C75EDD30属性未找到guidKey={2ACF1917-3743-41DF-A564-E727A80EA33E}
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetItemType@00000268C75EDD30属性未找到guidKey=MF\u SINK\u WRITER\u ASYNC\u回调
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType@00000268C75EDD30未找到属性guidKey=MF\u SINK\u WRITER\u DISABLE\u THROTTLING
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType@00000268C75EDD30未找到属性guidKey=MF\u SOURCE\u READER\u D3D\u MANAGER
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetUINT32@00000268C75EDD30属性未找到guidKey={BDAD7BCA-0E5F-4B10-AB16-26DE381B6293}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType@00000268C75EDD30未找到属性guidKey={39384300-D0EB-40B1-87A0-3318871B5A53}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType@00000268C75EDD30属性未找到guidKey={430847DA-0890-4B0E-938C-054332C547E1}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType@00000268C75EDD30属性未找到guidKey={43AD19CE-F33F-4BA9-A580-E4CD12F2D144}
5460,1BC 12:21:04.53060 CMFAttributesDetours::GetItemType@00000268C75EDD30属性未找到guidKey={273DB885-2DE2-4DB2-A6A7-FDB66FB40B61}
5460,1BC 12:21:04.53060 CMFReadWriteClassFactoryDetours::HandleObject@New sink writer@00000 268BA21E980
>>>在这里添加视频流(输入H264输出H264:基本上是一个直通)流。。。。
5460,1BC 12:21:04.53062 CKERNEL2ExportDetours::OutputDebugStringA@*********************************************************************************************222
5460,1BC 12:21:04.53063 CKERNEL2ExportDetours::OutputDebugStringA@
5460,1BC 12:21:04.53068 CMFATTRIBUTESDETORS::GetUnknown@00000268C75EDD30未找到属性guidKey=MF\u源\u读卡器\u D3D\u管理器
5460,1BC 12:21:04.53077 CMFSinkWriterTours::AddStream@00000268BA21E980流索引0x0,MT:MF_MT_FRAME_SIZE=5497558139600(1280720);MF_MT_MPEG_SEQUENCE_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20;MF\u MT\u MAJOR\u TYPE=媒体类型\u视频;帧速率=128849018881(30,1);MF_MT_像素_纵横比=4294967297(1,1);MF\u MT\u交错模式=2;MF\u MT\u SUBTYPE=MEDIASUBTYPE\u H264
5460,1BC 12:21:04.53085 CMFSinkWriterTours::SetInputMediaType@00000268BA21E980流索引0x0,MT:MF_MT_FRAME_SIZE=5497558139600(1280720);MF_MT_MPEG_SEQUENCE_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20;MF\u MT\u MAJOR\u TYPE=媒体类型\u视频;帧速率=128849018881(30,1);MF_MT_像素_纵横比=4294967297(1,1);MF\u MT\u交错模式=2;MF\u MT\u SUBTYPE=MEDIASUBTYPE\u H264
>>>正在此处添加第一个音频流。。。。
5460,1BC 12:21:04.53089 CKERNEL2ExportDetours::OutputDebugStringA@***************************************************************************333
5460,1BC 12:21:04.53092 CKERNEL2ExportDetours::OutputDebugStringA@
5460,1BC 12:21:04.53095 CMFATTRIBUTESDETORS::GetUnknown@00000268C75EDD30未找到属性guidKey=MF\u源\u读卡器\u D3D\u管理器
5460,1BC 12:21:04.53098 cmfsinkWriterTours::AddStream@00000268BA21E980流索引0x1,MT:MF_mtu音频_平均字节/u秒=16000;MF\u MT\u AUDIO\u NUM\u CHANNELS=2;MF\u MT\u MAJOR\u TYPE=媒体类型\u Audio;每秒音频采样数=44100;MF\u MT\u用户\u数据=00 00 29 00 00 00 12 10;MF\u MT\u音频\u位/u样本=16;MF_MT_SUBTYPE=MFAudioFormat_AAC
5460,1BC 12:21:04.53101 CKERNEL2ExportDetours::OutputDebugStringA@************************************************************************************************************************************444
5460,1BC 12:21:04.53102 CKERNEL2ExportDetours::OutputDebugStringA@
5460,1BC 12:21:04.53106 CMFATTRIBUTESDETORS::GetUnknown@00000268C75EDBB0未找到属性guidKey=MF\u SOURCE\u READER\u D3D_
5460,1BC 12:21:04.53040 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 111
5460,1BC 12:21:04.53043 CMFReadWriteExportDetours::MFCreateSinkWriterFromURL @ URL: '.mp4', bytestream @00000268FDFBFE90, MF_TRANSCODE_CONTAINERTYPE=MFTranscodeContainerType_MPEG4;MF_READWRITE_DISABLE_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS=0
5460,1BC 12:21:04.53054 COle32ExportDetours::CoCreateInstance @ Created {48E2ED0F-98C2-4A37-BED5-166312DDD83F} MFReadWrite Class Factory (C:\Windows\System32\mfreadwrite.dll) @00000268BA21BCC0 - traced interfaces: IMFReadWriteClassFactory @00000268BA21BCC0, 
5460,1BC 12:21:04.53055 CMFReadWriteClassFactoryDetours::CreateInstanceFromObject @00000268BA21BCC0 Object @00000268FDFBFE90, MF_TRANSCODE_CONTAINERTYPE=MFTranscodeContainerType_MPEG4;MF_READWRITE_DISABLE_CONVERTERS=1;{9C27891A-ED7A-40E1-88E8-B22727A024EE}=1;MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS=0
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF_SINK_WRITER_ASYNC_CALLBACK
5460,1BC 12:21:04.53056 CMFAttributesDetours::GetUINT32 @00000268C75EDD30 attribute not found guidKey = MF_SINK_WRITER_DISABLE_THROTTLING
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = {2ACF1917-3743-41DF-A564-E727A80EA33E}
5460,1BC 12:21:04.53057 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF_SINK_WRITER_ASYNC_CALLBACK
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF_SINK_WRITER_DISABLE_THROTTLING
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53058 CMFAttributesDetours::GetUINT32 @00000268C75EDD30 attribute not found guidKey = {BDAD7BCA-0E5F-4B10-AB16-26DE381B6293}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
5460,1BC 12:21:04.53059 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {43AD19CE-F33F-4BA9-A580-E4CD12F2D144}
5460,1BC 12:21:04.53060 CMFAttributesDetours::GetItemType @00000268C75EDD30 attribute not found guidKey = {273DB885-2DE2-4DB2-A6A7-FDB66FB40B61}
5460,1BC 12:21:04.53060 CMFReadWriteClassFactoryDetours::HandleObject @ New sink writer @00000268BA21E980

>>> adding video stream (input H264 ouput H264 : basically a passthrough) stream here....

5460,1BC 12:21:04.53062 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 222
5460,1BC 12:21:04.53063 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53068 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53077 CMFSinkWriterDetours::AddStream @00000268BA21E980 Stream Index 0x0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MPEG_SEQUENCE_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 04 00 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264
5460,1BC 12:21:04.53085 CMFSinkWriterDetours::SetInputMediaType @00000268BA21E980 Stream Index 0x0, MT: MF_MT_FRAME_SIZE=5497558139600 (1280,720);MF_MT_MPEG_SEQUENCE_HEADER=00 00 01 67 42 c0 1f 95 b0 14 01 6e c0 44 00 00 03 00 04 00 00 03 00 f0 36 82 21 1b 80 00 00 01 68 ca 8f 20 ;MF_MT_MAJOR_TYPE=MEDIATYPE_Video;MF_MT_FRAME_RATE=128849018881 (30,1);MF_MT_PIXEL_ASPECT_RATIO=4294967297 (1,1);MF_MT_INTERLACE_MODE=2;MF_MT_SUBTYPE=MEDIASUBTYPE_H264

>>> adding FIRST audio stream here....

5460,1BC 12:21:04.53089 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
5460,1BC 12:21:04.53092 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53095 CMFAttributesDetours::GetUnknown @00000268C75EDD30 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53098 CMFSinkWriterDetours::AddStream @00000268BA21E980 Stream Index 0x1, MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16000;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_USER_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_AAC
5460,1BC 12:21:04.53101 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 444
5460,1BC 12:21:04.53102 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53106 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53107 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MFT_FIELDOFUSE_UNLOCK_Attribute
5460,1BC 12:21:04.53107 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {D91B0085-C86D-4F81-8822-8C68E1D7FA04}
5460,1BC 12:21:04.53108 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {66B16DA9-ADD4-47E0-A16B-5AF1FB483634}
5460,1BC 12:21:04.53108 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {FB683E7E-1CAC-4DBD-9E97-A321EF334D67}
5460,1BC 12:21:04.53109 CMFPlatExportDetours::MFTEnumEx @ Category: MFT_CATEGORY_AUDIO_ENCODER, Flags: 0x00000073, input MT: <NULL>, output MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_SUBTYPE=MFAudioFormat_AAC
5460,1BC 12:21:04.53144 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53154 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53164 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53174 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53184 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53194 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53204 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53214 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53228 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53238 CMFAttributesDetours::GetUINT32 @00000268C75EDEB0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53314 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB54A30 - traced interfaces: 
5460,1BC 12:21:04.53389 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB55170 - traced interfaces: 
5460,1BC 12:21:04.53434 COle32ExportDetours::CoCreateInstance @ Created {00000339-0000-0000-C000-000000000046}  () @000002688EB57210 - traced interfaces: 
5460,1BC 12:21:04.53446 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = {3C0FBE52-D034-4115-995D-95B356B9855C}
5460,1BC 12:21:04.53447 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53447 CMFActivateDetours::GetStringLength @00000268C7FB49F0 attribute not found guidKey = MFT_ENUM_HARDWARE_URL_Attribute
5460,1BC 12:21:04.53450 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @00000268C7FB49F0, MFT_FRIENDLY_NAME_Attribute=Microsoft AAC Audio Encoder MFT;MFT_INPUT_TYPES_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 01 00 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT_TRANSFORM_CLSID_Attribute={93AF0C51-2275-45D2-A35B-F2BA21CAED00};MFT_OUTPUT_TYPES_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 10 16 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MF_TRANSFORM_FLAGS_Attribute=1;MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_AUDIO_ENCODER
5460,1BC 12:21:04.53485 COle32ExportDetours::CoCreateInstance @ New MFT @00000268B94D8F48, <NULL>
5460,1BC 12:21:04.53485 COle32ExportDetours::CoCreateInstance @ Created {93AF0C51-2275-45D2-A35B-F2BA21CAED00}  (C:\Windows\System32\mfAACEnc.dll) @00000268B94D8F48 - traced interfaces: IMFTransform @00000268B94D8F48, 
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUnknown @00000268C7FB49F0 attribute not found guidKey = MFT_PREFERRED_ENCODER_PROFILE
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUnknown @00000268C7FB49F0 attribute not found guidKey = MFT_PREFERRED_OUTPUTTYPE_Attribute
5460,1BC 12:21:04.53486 CMFActivateDetours::GetUINT32 @00000268C7FB49F0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
5460,1BC 12:21:04.53486 CMFActivateDetours::ActivateObject @00000268C7FB49F0 New MFT @00000268B94D8F48
5460,1BC 12:21:04.53488 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53488 CMFAttributesDetours::GetUINT32 @00000268C635CD80 attribute not found guidKey = MF_SA_D3D_AWARE
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {EACF97AD-065C-4408-BEE3-FDCBFD128BE2}
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {7B8F32C3-6D96-4B89-9203-DD38B61414F3}
5460,1BC 12:21:04.53489 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {39DBD44D-2E44-4931-A4C8-352D3DC42115}
5460,1BC 12:21:04.53490 CMFAttributesDetours::GetUINT32 @00000268C75EDBB0 attribute not found guidKey = {1B320A5D-DEAB-4986-95A3-950E19B82CB0}
5460,1BC 12:21:04.53491 CMFTransformDetours::SetInputType @00000268B94D8F48 Succeeded MT: <NULL>
5460,1BC 12:21:04.53491 CMFTransformDetours::SetOutputType @00000268B94D8F48 Succeeded MT: <NULL>
5460,1BC 12:21:04.53495 CMFTransformDetours::SetInputType @00000268B94D8F48 Succeeded MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=176400;MF_MT_AVG_BITRATE=1411200;MF_MT_AUDIO_BLOCK_ALIGNMENT=4;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=0;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_PCM
5460,1BC 12:21:04.53497 CMFTransformDetours::SetOutputType @00000268B94D8F48 Succeeded MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16000;MF_MT_AVG_BITRATE=128000;MF_MT_AUDIO_BLOCK_ALIGNMENT=1;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=1;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=41;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_USER_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF_MT_FIXED_SIZE_SAMPLES=0;MF_MT_AAC_PAYLOAD_TYPE=0;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_AAC
5460,1BC 12:21:04.53498 CMFAttributesDetours::GetUnknown @00000268C75EDBB0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
5460,1BC 12:21:04.53499 CMFAttributesDetours::GetUINT32 @00000268C635CD80 attribute not found guidKey = {039C0C90-25A9-4DD3-881D-5C1E1534E48B}
5460,1BC 12:21:04.53499 CMFAttributesDetours::GetString @00000268C75EDBB0 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
5460,1BC 12:21:04.53500 CMFAttributesDetours::GetString @00000268C75EDBB0 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
5460,1BC 12:21:04.53501 CMFSinkWriterDetours::SetInputMediaType @00000268BA21E980 Stream Index 0x1, MT: MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_PCM

>>> adding SECOND audio stream here....

5460,1BC 12:21:04.53505 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
5460,1BC 12:21:04.53507 CKernel32ExportDetours::OutputDebugStringA @  
5460,1BC 12:21:04.53509 CMFSinkWriterDetours::AddStream @00000268BA21E980 Failed MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16000;MF_MT_AVG_BITRATE=128000;MF_MT_AUDIO_BLOCK_ALIGNMENT=1;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=1;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=41;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_USER_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF_MT_FIXED_SIZE_SAMPLES=0;MF_MT_AAC_PAYLOAD_TYPE=0;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_AAC
>> Add the SECOND Audio AAC output... 

8156,2600 14:17:59.04339 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 333
8156,2600 14:17:59.04341 CKernel32ExportDetours::OutputDebugStringA @  
8156,2600 14:17:59.04343 CMFAttributesDetours::GetUnknown @000001A843796490 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
8156,2600 14:17:59.04345 CMFSinkWriterDetours::AddStream @000001A8411B0A50 Stream Index 0x2, MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16000;MF_MT_AVG_BITRATE=128000;MF_MT_AUDIO_BLOCK_ALIGNMENT=1;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=1;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=41;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_USER_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF_MT_FIXED_SIZE_SAMPLES=0;MF_MT_AAC_PAYLOAD_TYPE=0;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_AAC

>> Add the SECOND Audio PCM input... 

    8156,2600 14:17:59.04346 CKernel32ExportDetours::OutputDebugStringA @ ******************************************************** 444
    8156,2600 14:17:59.04347 CKernel32ExportDetours::OutputDebugStringA @  
    8156,2600 14:17:59.04350 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
    8156,2600 14:17:59.04350 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MFT_FIELDOFUSE_UNLOCK_Attribute
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {D91B0085-C86D-4F81-8822-8C68E1D7FA04}
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {66B16DA9-ADD4-47E0-A16B-5AF1FB483634}
    8156,2600 14:17:59.04351 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {6CE5CB40-ABD3-4A0D-849C-EDF871656C5E}
    8156,2600 14:17:59.04352 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {FB683E7E-1CAC-4DBD-9E97-A321EF334D67}
    8156,2600 14:17:59.04352 CMFAttributesDetours::GetBlobSize @000001A8374F10F0 attribute not found guidKey = {1D39518C-E220-4DA8-A07F-BA172552D6B1}
    8156,2600 14:17:59.04353 CMFPlatExportDetours::MFTEnumEx @ Category: MFT_CATEGORY_AUDIO_ENCODER, Flags: 0x00000073, input MT: <NULL>, output MT: MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_SUBTYPE=MFAudioFormat_AAC
    8156,2600 14:17:59.04354 CMFAttributesDetours::GetUINT32 @000001A8437968B0 attribute not found guidKey = {3C0FBE52-D034-4115-995D-95B356B9855C}
    8156,2600 14:17:59.04356 CMFPlatExportDetours::MFTEnumEx @ Activate 00 @000001A85295DEC0, MFT_FRIENDLY_NAME_Attribute=Microsoft AAC Audio Encoder MFT;MFT_INPUT_TYPES_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 01 00 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MFT_TRANSFORM_CLSID_Attribute={93AF0C51-2275-45D2-A35B-F2BA21CAED00};MFT_OUTPUT_TYPES_Attributes=61 75 64 73 00 00 10 00 80 00 00 aa 00 38 9b 71 10 16 00 00 00 00 10 00 80 00 00 aa 00 38 9b 71 ;MF_TRANSFORM_FLAGS_Attribute=1;MF_TRANSFORM_CATEGORY_Attribute=MFT_CATEGORY_AUDIO_ENCODER
    8156,2600 14:17:59.04357 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = {2ACF1917-3743-41DF-A564-E727A80EA33E}
    8156,2600 14:17:59.04377 COle32ExportDetours::CoCreateInstance @ New MFT @000001A814078068, <NULL>
    8156,2600 14:17:59.04377 COle32ExportDetours::CoCreateInstance @ Created {93AF0C51-2275-45D2-A35B-F2BA21CAED00}  (C:\Windows\System32\mfAACEnc.dll) @000001A814078068 - traced interfaces: IMFTransform @000001A814078068, 
    8156,2600 14:17:59.04377 CMFActivateDetours::GetUnknown @000001A85295DEC0 attribute not found guidKey = MFT_PREFERRED_ENCODER_PROFILE
    8156,2600 14:17:59.04377 CMFActivateDetours::GetUnknown @000001A85295DEC0 attribute not found guidKey = MFT_PREFERRED_OUTPUTTYPE_Attribute
    8156,2600 14:17:59.04378 CMFActivateDetours::GetUINT32 @000001A85295DEC0 attribute not found guidKey = MFT_CODEC_MERIT_Attribute
    8156,2600 14:17:59.04378 CMFActivateDetours::ActivateObject @000001A85295DEC0 New MFT @000001A814078068
    8156,2600 14:17:59.04379 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
    8156,2600 14:17:59.04379 CMFAttributesDetours::GetUINT32 @000001A8374F0F10 attribute not found guidKey = MF_SA_D3D_AWARE
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {EACF97AD-065C-4408-BEE3-FDCBFD128BE2}
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {7B8F32C3-6D96-4B89-9203-DD38B61414F3}
    8156,2600 14:17:59.04380 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {39DBD44D-2E44-4931-A4C8-352D3DC42115}
    8156,2600 14:17:59.04381 CMFAttributesDetours::GetUINT32 @000001A8374F10F0 attribute not found guidKey = {1B320A5D-DEAB-4986-95A3-950E19B82CB0}
    8156,2600 14:17:59.04382 CMFTransformDetours::SetInputType @000001A814078068 Succeeded MT: <NULL>
    8156,2600 14:17:59.04382 CMFTransformDetours::SetOutputType @000001A814078068 Succeeded MT: <NULL>
    8156,2600 14:17:59.04385 CMFTransformDetours::SetInputType @000001A814078068 Succeeded MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=176400;MF_MT_AVG_BITRATE=1411200;MF_MT_AUDIO_BLOCK_ALIGNMENT=4;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=0;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_FIXED_SIZE_SAMPLES=1;MF_MT_ALL_SAMPLES_INDEPENDENT=1;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_PCM
    8156,2600 14:17:59.04388 CMFTransformDetours::SetOutputType @000001A814078068 Succeeded MT: MF_MT_AUDIO_AVG_BYTES_PER_SECOND=16000;MF_MT_AVG_BITRATE=128000;MF_MT_AUDIO_BLOCK_ALIGNMENT=1;MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_COMPRESSED=1;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AM_FORMAT_TYPE=FORMAT_WaveFormatEx;MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION=41;MF_MT_AUDIO_PREFER_WAVEFORMATEX=1;MF_MT_USER_DATA=00 00 29 00 00 00 00 00 00 00 00 00 12 10 ;MF_MT_FIXED_SIZE_SAMPLES=0;MF_MT_AAC_PAYLOAD_TYPE=0;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_AAC
    8156,2600 14:17:59.04388 CMFAttributesDetours::GetUnknown @000001A8374F10F0 attribute not found guidKey = MF_SOURCE_READER_D3D_MANAGER
    8156,2600 14:17:59.04389 CMFAttributesDetours::GetUINT32 @000001A8374F0F10 attribute not found guidKey = {039C0C90-25A9-4DD3-881D-5C1E1534E48B}
    8156,2600 14:17:59.04390 CMFAttributesDetours::GetString @000001A8374F10F0 attribute not found guidKey = {430847DA-0890-4B0E-938C-054332C547E1}
    8156,2600 14:17:59.04391 CMFAttributesDetours::GetString @000001A8374F10F0 attribute not found guidKey = {39384300-D0EB-40B1-87A0-3318871B5A53}
    8156,2600 14:17:59.04392 CMFSinkWriterDetours::SetInputMediaType @000001A8411B0A50 Stream Index 0x2, MT: MF_MT_AUDIO_NUM_CHANNELS=2;MF_MT_MAJOR_TYPE=MEDIATYPE_Audio;MF_MT_AUDIO_SAMPLES_PER_SECOND=44100;MF_MT_AUDIO_BITS_PER_SAMPLE=16;MF_MT_SUBTYPE=MFAudioFormat_PCM
HRESULT UpdateAudioOutputTypeAttributes(IMFAttributes *pAttr)  
{  
    HRESULT hr = S_OK;  
    if (!pAttr){  
        hr = E_INVALIDARG;  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF_MT_SUBTYPE, DEFAULT_AUDIO_OUT_FORMAT);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_COMPRESSED, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AVG_BITRATE, DEFAULT_AUDIO_OUT_AVG_BITRATE);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_PREFER_WAVEFORMATEX, 1);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetGUID(MF_MT_AM_FORMAT_TYPE, FORMAT_WaveFormatEx);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, DEFAULT_AUDIO_OUT_PROFILE_LEVEL);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, 0);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, DEFAULT_AUDIO_OUT_NUM_CHANNELS);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, DEFAULT_AUDIO_OUT_SAMPLES_PER_SECOND);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, DEFAULT_AUDIO_OUT_AVG_BYTES_PER_SECOND);  
    }  
    if (SUCCEEDED(hr)){  
        hr = pAttr->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, DEFAULT_AUDIO_OUT_BITS_PER_SAMPLE);  
    }  
    if (SUCCEEDED(hr)){  
        BYTE aacUserData[14] = { 0x00, 0x00, DEFAULT_AUDIO_OUT_PROFILE_LEVEL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };  
        WORD AudioSpecificConfig = 0;  
        AudioSpecificConfig |= 2 << 11;  
        AudioSpecificConfig |= FindFreqIndex(g_pWaveFmt->nSamplesPerSec) << 7;  
        AudioSpecificConfig |= g_pWaveFmt->nChannels << 3;  
        aacUserData[12] = AudioSpecificConfig >> 8;  
        aacUserData[13] = AudioSpecificConfig & 0x00FF;  
        hr = pAttr->SetBlob(MF_MT_USER_DATA, (UINT8*)&(aacUserData), ARRAYSIZE(aacUserData));  
    }  
    return hr;  
}