Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于多线程预览录制的问题 #164

Open
ab503044120 opened this issue Aug 25, 2021 · 0 comments
Open

关于多线程预览录制的问题 #164

ab503044120 opened this issue Aug 25, 2021 · 0 comments

Comments

@ab503044120
Copy link

ab503044120 commented Aug 25, 2021

在您https://www.jianshu.com/p/9dc03b01bae3 这个文中讲到
编码管理器主要用于管理MediaMuxer、MediaCodec、录制渲染所需要的WindowSurface、EglCore等的初始化以及销毁等操作。根据RecordManager传递过来的OpenGLES共享上下文EGLContext,我们需要重新创建一个EglCore 和 录制用的WindowSurface,录制渲染部分需要用到,在drawRecorderFrame中,我们通过WindowSurface切换到当前线程的共享上下文状态下,做录制渲染绘制工作。这里通过handler将渲染部分的Texture发送给当前线程进行绘制,这里有个细节需要注意的是,由于OpenGLES 不是线程安全的,多线程渲染是通过TLS(Thread Local Storage)机制实现的,因此这里的Texture不能跟RenderManager共用,必须通过handler发送给录制的HandlerThread中存储起来,这样在录制线程渲染完之前,RenderManager可以渲染不同的Texture,如果共用,那么这里会产生录制一闪一闪的情况。
但是我在grafika项目中看到 Race condition in "show + capture camera"
因此您项目中的多线程录制代码会不会有问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant