Locked

使用Flash player ActiveX控件加载SWF播放RTMP出现断言

New Here ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

开发环境:64位WIN10,Flash28,Visual Studio 2015

概要:使用VS2015开发一个MFC程序,内嵌Flash Player ActiveX控件(Shockwave Flash Object)。播放RTMP流后,关闭MFC程序窗口时出现断言错误。

详情:本人最近在开发一个MFC程序,需要在MFC程序中调用FlashActiveX控件,加载SWF文件,播放RTMP实时流。MFC程序使用的是.NET 4 Framework,Flash使用的28版本,SWF文件使用的是video-js-swf项目的SWF文件。开发流程是:①在MFC对话框资源页面中,使用类向导——“ActiveX控件中的MFC类”——选择“文件”——下行打开文件flash.ocx,输入框中出现“C:\Windows\System32\Macromed\Flash\Flash.ocx\1”——从接口列表选择“IShockwaveFlash”并添加到生成的类列表——点击完成。②在MFC对话框中右键“插入ActiveX控件”——选择“Shockwave Flash Object”——调整控件大小。③在刚插入的ActiveX控件,点击右键——“添加变量”——变量名填入“m_flash”。④在MFC对话框的CPP文件中,函数OnInitDialog中添加额外初始化代码:

CString str = _T("D:\\video-js-swf\\dist\\video-js.swf");

m_flash.LoadMovie(0, str);

⑤添加播放RTMP的代码:(放到开始按钮)

CString temp1 = _T(R"(<invoke name="vjs_setProperty" returntype="xml"><arguments><string>autoplay</string><true/></arguments></invoke>)");

retStr = m_flash.CallFunction(temp1);

CString temp2 = _T(R"(<invoke name="vjs_setProperty" returntype="xml">\

<arguments><string>rtmpConnection</string><string>rtmp://128.8.51.21:1935/live/</string></arguments>\

</invoke>)");

retStr = m_flash.CallFunction(temp2);

CString temp3 = _T(R"(<invoke name="vjs_setProperty" returntype="xml">\

<arguments><string>rtmpStream</string><string>test1?rate=master</string></arguments>\

</invoke>)");

retStr = m_flash.CallFunction(temp3);

⑥添加停止RTMP的代码:(放到停止按钮)

CString pauseplay = _T(R"(<invoke name="vjs_pause" returntype="xml">\

<arguments></arguments>\

</invoke>)");

retStr = m_flash.CallFunction(pauseplay);

CString stopplay = _T(R"(<invoke name="vjs_stop" returntype="xml">\

<arguments></arguments>\

</invoke>)");

retStr = m_flash.CallFunction(stopplay);

⑦完成,生成代码,运行。

下面是两种调试运行效果:

运行MFC程序,关闭窗口,正常退出。

运行MFC程序,开始播放,停止播放,关闭窗口,出现断言中断异常。

异常信息:

0x743A778F (combase.dll)处(位于 FlashTestMFC.exe 中)引发的异常: 0xC0000005: 读取位置 0x5BA86498 时发生访问冲突。

且代码中断在

appterm.cpp(43行)

if (pThread != NULL && pThread->m_lpfnOleTermOrFreeLib != NULL)

(*pThread->m_lpfnOleTermOrFreeLib)(TRUE, FALSE);

调用堆栈:

combase.dll!743a778f()未知
[下面的框架可能不正确和/或缺失,没有为 combase.dll 加载符号]
combase.dll!743a76fc()未知
combase.dll!743671a5()未知
user32.dll!__InternalCallWinProc@20 ()未知
combase.dll!74364cbf()未知
ntdll.dll!76f20bad()未知
win32u.dll!755b29ec()未知
user32.dll!_PeekMessage(struct tagMSG *,struct HWND__ *,unsigned int,unsigned int,unsigned int,int)未知
>mfc140d.dll!AfxWinTerm() 行 44C++
mfc140d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00190000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x028969ca, int nCmdShow=10) 行 62C++
FlashTestMFC.exe!WinMain(HINSTANCE__ * hInstance=0x00190000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x028969ca, int nCmdShow=10) 行 26C++
FlashTestMFC.exe!invoke_main() 行 109C++
FlashTestMFC.exe!__scrt_common_main_seh() 行 264C++
FlashTestMFC.exe!__scrt_common_main() 行 309C++
FlashTestMFC.exe!WinMainCRTStartup() 行 17C++
kernel32.dll!754e8654()未知
ntdll.dll!76f14a47()未知
ntdll.dll!76f14a17()未知

这是因为flash播放了视频过后没有进行内存回收,导致存在内存泄漏吗?该怎么解决

消息编辑者为:J Kun Qiu

Views

414

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

The supported use-case for Flash Player is as an embedded plug-in, running in a web browser.

Adobe AIR is the supported technology for building a desktop application using Flash technology.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines