{"action":"created","issue":{"url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/30","repository_url":"https://api.github.com/repos/wysaid/android-gpuimage-plus","labels_url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/30/comments","events_url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/30/events","html_url":"https://github.com/wysaid/android-gpuimage-plus/issues/30","id":182685614,"number":30,"title":"glReadPixels的效率问题","user":{"login":"tingfengainiaini","id":3971506,"avatar_url":"https://avatars.githubusercontent.com/u/3971506?v=3","gravatar_id":"","url":"https://api.github.com/users/tingfengainiaini","html_url":"https://github.com/tingfengainiaini","followers_url":"https://api.github.com/users/tingfengainiaini/followers","following_url":"https://api.github.com/users/tingfengainiaini/following{/other_user}","gists_url":"https://api.github.com/users/tingfengainiaini/gists{/gist_id}","starred_url":"https://api.github.com/users/tingfengainiaini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tingfengainiaini/subscriptions","organizations_url":"https://api.github.com/users/tingfengainiaini/orgs","repos_url":"https://api.github.com/users/tingfengainiaini/repos","events_url":"https://api.github.com/users/tingfengainiaini/events{/privacy}","received_events_url":"https://api.github.com/users/tingfengainiaini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-13T03:17:48Z","updated_at":"2016-10-15T03:08:19Z","closed_at":null,"body":"hi，大师兄，我想对滤镜每帧图片进行加表情图片（边录制边加），但是项目代码中目前没有给出Recorder的native的实现（期待啊），无奈只能在onDrawFrame中读取每一帧图片出来，然后处理，主要处理的方式为：\r\n```\r\nGLES20.glViewport(0, 0, mRecordWidth, mRecordHeight);\r\nmFrameRecorder.drawCache();\r\nmFrameBuffer.position(0);\r\nGLES20.glReadPixels(0, 0, mRecordWidth, mRecordHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, mFrameBuffer);\r\nmFrameBmp.copyPixelsFromBuffer(mFrameBuffer);\r\n```\r\n这里width和hight是480*480。从这里读取出来得frame已经是你的底层native加好滤镜的帧了，这里拿到bitmap以后我会用canvas将表情图片draw到mFrameBmp上面，然后进行encode（没有重新写ffmpeg的encode，用了javacv）。\r\n这套逻辑基本是可以工作的。但是问题是，上面的这几行代码对延迟相机预览，改动之前相机预览帧率是30，加上这几行以后变成了22帧左右。多次测试以后发现主要是GLES20.glReadPixels造成的延迟。\r\n\r\n大师兄，有什么建议吗？\r\n"},"comment":{"url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/comments/253958926","html_url":"https://github.com/wysaid/android-gpuimage-plus/issues/30#issuecomment-253958926","issue_url":"https://api.github.com/repos/wysaid/android-gpuimage-plus/issues/30","id":253958926,"user":{"login":"tingfengainiaini","id":3971506,"avatar_url":"https://avatars.githubusercontent.com/u/3971506?v=3","gravatar_id":"","url":"https://api.github.com/users/tingfengainiaini","html_url":"https://github.com/tingfengainiaini","followers_url":"https://api.github.com/users/tingfengainiaini/followers","following_url":"https://api.github.com/users/tingfengainiaini/following{/other_user}","gists_url":"https://api.github.com/users/tingfengainiaini/gists{/gist_id}","starred_url":"https://api.github.com/users/tingfengainiaini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tingfengainiaini/subscriptions","organizations_url":"https://api.github.com/users/tingfengainiaini/orgs","repos_url":"https://api.github.com/users/tingfengainiaini/repos","events_url":"https://api.github.com/users/tingfengainiaini/events{/privacy}","received_events_url":"https://api.github.com/users/tingfengainiaini/received_events","type":"User","site_admin":false},"created_at":"2016-10-15T03:08:19Z","updated_at":"2016-10-15T03:08:19Z","body":"@wysaid 昨天有事情没看到消息。我今天试一下纹理的方式。谢谢大师兄。"}}
{"actor":{"display_login":"tingfengainiaini"}}