在 IMFMediaSource::ReadSample 中追踪 E_POINTER 的来源
我从 ReadSample 调用中收到 E_POINTER 错误,据我所知,没有一个指针无效。请参阅下面的代码片段(注意,它是一个 C++/CLI 应用程序):
IMFSample* sample = NULL;
pin_ptr<IMFSample*> pinnedSample = &sample;
LONGLONG timeStamp;
HRESULT hr = mSourceReader->ReadSample(
(DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM,
0,
NULL,
NULL,
&timeStamp,
pinnedSample
);
我怀疑问题在于 mSourceReader(一个 IMFSourceReader 实例,从 IMFMediaSource 创建的)的构造。但是,唉,我不知道如何回溯并找到源代码,因为创建 mSourceReader 的命令链中的所有 COM 调用都返回 S_OK。
非常感谢您的任何提示。
I'm getting an E_POINTER error from the ReadSample call, and as far as I can tell, none of the pointers are invalid. See snippet below (note, it's a C++/CLI app):
IMFSample* sample = NULL;
pin_ptr<IMFSample*> pinnedSample = &sample;
LONGLONG timeStamp;
HRESULT hr = mSourceReader->ReadSample(
(DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM,
0,
NULL,
NULL,
&timeStamp,
pinnedSample
);
I suspect the problem lies in the construction of the mSourceReader (an IMFSourceReader instance, created from an IMFMediaSource). But, alas, I've no idea how to backtrack and find the source, as all the COM calls in the chain of commands that created mSourceReader returned S_OK.
Much thanks for any tips.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
获取局部变量的地址时不需要
pin_ptr
,因为垃圾收集器无论如何都不会移动局部变量。我猜想您传递 NULL 的其他三个参数之一是非可选的,但我需要查看您正在调用哪个函数才能确定。
您是在同步还是异步模式下创建
IMFSourceReader
吗?文档说:我认为这是你的问题:
您已为
pdwStreamFlags
传递了 NULL,这是不允许的。文档链接: http://msdn.microsoft.com/en-us/library /dd374665.aspx
You don't need
pin_ptr
when taking the address of a local variable, since the garbage collector never moves local variables around anyway.I'd guess that one of the other three parameters you're passing NULL to is non-optional, but I need to see what function you're calling to know for sure.
Did you create the
IMFSourceReader
in synchronous or asynchronous mode? The docs say:I think this is your problem:
You've passed NULL for
pdwStreamFlags
, which is not allowed.Doc link: http://msdn.microsoft.com/en-us/library/dd374665.aspx