Delphi 我的DirectShow筛选器在通话中崩溃Skype 5.x。在4.x、图形编辑和其他程序中运行良好
我有一个DirectShow推送源视频过滤器,它是用Delphi6和DSPACK组件库编写的。只要使用该筛选器的Skype客户端不是5.x或更新版本,则该筛选器在Skype呼叫期间可以正常运行。使用5.x时,Skype客户端会变得非常迟钝,直到挂起,然后会出现各种严重的崩溃,包括数据执行预防警告和典型的Microsoft“此程序已崩溃”对话框。有时它会立即崩溃,有时它会在通话30秒或更长时间后崩溃 我还可以在以下上下文中无错误地运行视频过滤器:Delphi 我的DirectShow筛选器在通话中崩溃Skype 5.x。在4.x、图形编辑和其他程序中运行良好,delphi,video,directshow,skype,dspack,Delphi,Video,Directshow,Skype,Dspack,我有一个DirectShow推送源视频过滤器,它是用Delphi6和DSPACK组件库编写的。只要使用该筛选器的Skype客户端不是5.x或更新版本,则该筛选器在Skype呼叫期间可以正常运行。使用5.x时,Skype客户端会变得非常迟钝,直到挂起,然后会出现各种严重的崩溃,包括数据执行预防警告和典型的Microsoft“此程序已崩溃”对话框。有时它会立即崩溃,有时它会在通话30秒或更长时间后崩溃 我还可以在以下上下文中无错误地运行视频过滤器: 在视频过滤器预览窗口中使用Skype 5.x,您
- 在视频过滤器预览窗口中使用Skype 5.x,您可以在选择要与Skype一起使用的视频设备时看到该窗口(不是在通话中,而是在“视频选项选择”对话框页面)
- Skype 4.x客户端(在通话和通话中都能完美运行)
- 图形编辑
- DSPACK TVideoWindow实例
- 其他利用网络摄像头提要的程序
function TBCPushPinDesktop.GetStreamCaps(iIndex: Integer; out ppmt: PAMMediaType; out pSCC): HResult;
var
pvi:PVIDEOINFOHEADER;
begin
ppmt := CreateMediaType(@Fmt);
pvi:=PVIDEOINFOHEADER(ppmt.pbFormat);
// Error occurs at THIS statement, the first attempt to write to the memory area
// provided by Skype.
pvi.bmiHeader.biCompression := BI_RGB;
.... SNIP ....
end;
更新2:我的代码有问题,但我不知道是什么。Graph Edit不像Skype那样调用GetStreamCaps()。我添加了更多的跟踪语句,结果发现在上面的代码中,DSPACK CreateMediaType()调用返回的媒体类型对象有一个NIL pbFormat字段,因此可以解释fast失败的原因。如果有人知道我需要做什么才能得到一个正确配置的pbFormat字段,请告诉我。下面是执行CreateMediaType()操作的DSPACK中的代码:
// this also comes in useful when using the IEnumMediaTypes interface so
// that you can copy a media type, you can do nearly the same by creating
// a CMediaType object but as soon as it goes out of scope the destructor
// will delete the memory it allocated (this takes a copy of the memory)
function CreateMediaType(pSrc: PAMMediaType): PAMMediaType;
var pMediaType: PAMMediaType;
begin
ASSERT(pSrc<>nil);
// Allocate a block of memory for the media type
pMediaType := CoTaskMemAlloc(sizeof(TAMMediaType));
if (pMediaType = nil) then
begin
result := nil;
exit;
end;
// Copy the variable length format block
CopyMediaType(pMediaType,pSrc);
result := pMediaType;
end;
//----------------------------------------------------------------------------
// Copies a task-allocated AM_MEDIA_TYPE structure.
//----------------------------------------------------------------------------
procedure CopyMediaType(pmtTarget: PAMMediaType; pmtSource: PAMMediaType);
begin
// We'll leak if we copy onto one that already exists - there's one
// case we can check like that - copying to itself.
ASSERT(pmtSource <> pmtTarget);
//pmtTarget^ := pmtSource^;
move(pmtSource^, pmtTarget^, SizeOf(TAMMediaType));
if (pmtSource.cbFormat <> 0) then
begin
ASSERT(pmtSource.pbFormat <> nil);
pmtTarget.pbFormat := CoTaskMemAlloc(pmtSource.cbFormat);
if (pmtTarget.pbFormat = nil) then
pmtTarget.cbFormat := 0
else
CopyMemory(pmtTarget.pbFormat, pmtSource.pbFormat, pmtTarget.cbFormat);
end;
if (pmtTarget.pUnk <> nil) then pmtTarget.pUnk._AddRef;
end;
//这在使用IEnumMediaTypes接口时也很有用
//您可以复制媒体类型,也可以通过创建
//一个CMediaType对象,但一旦它超出范围,析构函数
//将删除分配的内存(这将获取内存的副本)
函数CreateMediaType(pSrc:PAMMediaType):PAMMediaType;
var pMediaType:PAMMediaType;
开始
断言(pSrcnil);
//为媒体类型分配一块内存
pMediaType:=CoTaskMemAlloc(sizeof(TAMMediaType));
如果(pMediaType=nil),则
开始
结果:=无;
出口
结束;
//复制可变长度格式块
CopyMediaType(pMediaType,pSrc);
结果:=pMediaType;
结束;
//----------------------------------------------------------------------------
//复制任务分配的AM_介质类型结构。
//----------------------------------------------------------------------------
过程CopyMediaType(pmtTarget:PAMMediaType;pmtSource:PAMMediaType);
开始
//如果我们复制到一个已经存在的系统上,我们会泄露信息——有一个
//我们可以这样检查案例-复制到自身。
断言(pmtSource-pmtTarget);
//pmtTarget^:=pmtSource^;
move(pmtSource^,pmtTarget^,SizeOf(TAMMediaType));
如果(pmtSource.cb0格式),则
开始
断言(pmtSource.pbFormat nil);
pmtTarget.pbFormat:=CoTaskMemAlloc(pmtSource.cbFormat);
如果(pmtTarget.pbFormat=nil),则
pmtTarget.cbFormat:=0
其他的
CopyMemory(pmtTarget.pbFormat、pmtSource.pbFormat、pmtTarget.cbFormat);
结束;
如果(pmtTarget.pUnk nil),则pmtTarget.pUnk.\u AddRef;
结束;
有很多信息,但我能掌握以下几点:
ppmt := CreateMediaType(@Fmt);
pvi:=PVIDEOINFOHEADER(ppmt.pbFormat);
// Error occurs at THIS statement, the first attempt to write to the memory area
// provided by Skype.
pvi.bmiHeader.biCompression := BI_RGB;
你能打ac的唯一原因