tencentyun / MLVBSDK

移动直播 SDK,国内下载镜像:
https://cloud.tencent.com/document/product/454/7873
775 stars 917 forks source link

【iOS】-cocos creator直播SDK接入后会导致openGL报错 #58

Closed zhaxun closed 4 years ago

zhaxun commented 4 years ago

【当前现象】 1、直播推流接入时,第一次启动授权后,会闪退一次(必现) 2、直播停止时,调用stopPreview会导致opengl报错 _2019-12-24 15:36:20.035934+0800 Live-mobile[3491:1387562] [I][TXLivePush.m, stopPreview, 818]:liteav_api 0x280398410 stopPreview 2019-12-24 15:36:20.178709+0800 Live-mobile[3491:1387562] [I][TXCRenderViewiOS.m, dealloc, 362]:TXCRenderView dealloc:0x107c175e0 OpenGL error 0x0502 in -[CCEAGLView swapBuffers] 406 OpenGL error 0x0500 in -[CCEAGLView swapBuffers] 432

【集成包】 基础版Smart cocos creator2.2

【复现概率】 必现

【复现途径】

  1. 调用 startPreview
  2. 调用 stopPreview
  3. 出现 Bug

【相关附件】 调起方法:mViewController.view为cocos引擎的根视图 CGRect bounds = [[UIScreen mainScreen] bounds]; _pushView = [[CameraPushView alloc] initWithFrame:bounds]; [[mViewController.view viewWithTag:10] addSubview:_pushView]; 提供方法:

CameraPushView接口(就是将CameraPushViewController修改为UIView): Snip20191224_1

请在附件中添加相关视频、日志,截图、操作视频等

zhaxun commented 4 years ago

修改 CCEAGLView-ios.mm文件

if COCOS2D_DEBUG

CHECK_GL_ERROR();

endif

// We can safely re-bind the framebuffer here, since this will be the
// 1st instruction of the new main loop
if(_multisampling)
    glBindFramebuffer(GL_FRAMEBUFFER, _msaaFramebuffer);

}

zhaxun commented 4 years ago

进入后切回前台时crash的解决办法:

修改AppDelegate.cpp文件 void AppDelegate::applicationDidEnterBackground() { EventDispatcher::dispatchEnterBackgroundEvent(); renderer::BaseRenderer::enterback = 30;//设置进入后台时设置延迟渲染帧数 }

修改RenderFlow.cpp,延迟去渲染! void RenderFlow::render(NodeProxy* scene, float deltaTime) { // CCLOG("RenderFlow::render: %d deltaTime:%.4f", BaseRenderer::enterback,deltaTime); if(BaseRenderer::enterback > 0){ BaseRenderer::enterback -= 1; return; }