From c6500d3aee87488cd6ef4ffbbfc0fd9da6ccdc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rulong=20Chen=EF=BC=88=E9=99=88=E6=B1=9D=E9=BE=99=EF=BC=89?= Date: Tue, 18 Jun 2024 10:00:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E4=B8=8BPlatformView=E5=8C=BA=E5=9F=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=BB=91=E5=B1=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原因:当调用MarkNewFrameAvailable函数时,OHOSExternalTextureGL还未初始化。 Change-Id: Ib58f9b118cd93ee9e7208dd0e8e0b3c5c6b457cb --- shell/platform/ohos/ohos_external_texture_gl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index ad1c4e2d70..788a215814 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -86,7 +86,8 @@ void OHOSExternalTextureGL::Attach() int32_t ret = OH_NativeImage_AttachContext(nativeImage_, texture_name_); if (ret != 0) { - FML_DLOG(FATAL)<<"OHOSExternalTextureGL OH_NativeImage_AttachContext err code:"<< ret; + FML_DLOG(FATAL) << "Failed to attach current GL context. ErrorCode:" << ret; + return; } state_ = AttachmentState::attached; } else { @@ -174,7 +175,13 @@ void OHOSExternalTextureGL::OnGrContextDestroyed() void OHOSExternalTextureGL::MarkNewFrameAvailable() { - FML_DLOG(INFO)<<" OHOSExternalTextureGL::MarkNewFrameAvailable"; + FML_DLOG(INFO)<< "OHOSExternalTextureGL::MarkNewFrameAvailable"; + if (state_ == AttachmentState::detached) { + return; + } + if (state_ == AttachmentState::uninitialized) { + Attach(); + } new_frame_ready_ = true; Update(); } -- Gitee