So the problem only occurs when I try and record for the second time. Meaning the first time I run the MediaCodecs and Muxer everything works most of the time. But now I want the app to be more stable.
所以问题只发生在我第二次尝试和记录的时候。这意味着我第一次运行MediaCodecs和Muxer时,大部分时间都在运行。但现在我希望应用程序更加稳定。
Help figure out what is not being torn down and setup correctly.
帮助弄清楚什么东西没有被拆掉和安装正确。
Basically on the second run, everything setup fine, but when 'Renderer.drawFrame' calls GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
I get the error: I/Adreno﹕ Native window GetBuffer failed
基本上在第二次运行时,一切设置都很好,但是当渲染器。拉伸机的电话GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);我得到错误:我/肾上腺素的本机窗口GetBuffer失败。
And when GLES20.glFlush();
is called the error is: I/Adreno﹕ Failed to acquire a surface
当GLES20.glFlush();所谓的错误是:我/肾上腺素没有得到一个表面?
Which always precedes the eglSwapBuffers: EGL error: 0x300d
when I try swapping the buffers. So something isn't getting cleaned up from the first run.
它总是先于eglswapbuffer: EGL错误:0x300d,当我尝试交换缓冲区时。所以从一开始就没有清理干净。
Clean Up code:
清理代码:
public void releaseCapture(){
if (audioCodec != null){
audioCodec.stop();
audioCodec = null;
}
if (videoCodec != null){
videoCodec.stop();
videoCodec = null;
}
if (mediaMux != null){
mediaMux.release();
mediaMux = null;
}
if ( releaseAll ) {
releaseAll = false;
//releaseSurfaceTexture();
mEGLWrapper.destroySurface();
}
}
MyMediaCodec.stop()
MyMediaCodec.stop()
public void stop(){
if (codec == null) return;
if (!isAudioCodec) {
videoCodecInputSurface.release();
}
codecPrimed=false;
codec.stop();
codec.release();
codec = null;
codecManager.stopMuxer(isAudioCodec);
}
MyMediaMuxer.stop()
MyMediaMuxer.stop()
public void stopMuxer(boolean isAudio){
if (mediaMux == null) return;
if (isAudio){
audioActive = false;
} else {
videoActive = false;
}
if (!(audioActive||videoActive)){
Log.d(TAG, "Stopping Muxer now. audio frame count = " + audioFrameCount +
"; video frame count = " + videoFrameCount);
videoHandler.postDelayed(new Runnable(){
@Override
public void run() {
if (mediaMux!=null) mediaMux.stop();
// set up for next run
releaseCapture();
}
},frame_delay);
}
}
mEGLWrapper.destroySurface();
mEGLWrapper.destroySurface();
public void destroySurface(){
EGL14.eglDestroySurface(mEGLDisplay,mEGLSurface);
checkEglError("eglDestroySurace");
}
Errorlog
Errorlog
05-05 17:51:43.072 27756-27913/com.harmonicprocesses.penelopefree
E/OMXMaster﹕ A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
05-05 17:51:43.085 27756-27918/com.harmonicprocesses.penelopefree I/OMXClient﹕ Using client-side OMX mux.
05-05 17:51:43.470 27756-27756/com.harmonicprocesses.penelopefree D/penny.cam.MyMediaCodec﹕ Camera profile: Frame Rate = 30; Bit Rate = 42000000
05-05 17:51:43.470 27756-27756/com.harmonicprocesses.penelopefree D/penny.cam.MyMediaCodec﹕ ; Heighth = 2160; Width = 3840
05-05 17:51:43.472 27756-27918/com.harmonicprocesses.penelopefree E/ACodec﹕ [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
05-05 17:51:43.474 27756-27918/com.harmonicprocesses.penelopefree W/ACodec﹕ do not know color format 0x7fa30c04 = 2141391876
05-05 17:51:43.475 27756-27918/com.harmonicprocesses.penelopefree W/ACodec﹕ do not know color format 0x7f000789 = 2130708361
05-05 17:51:43.478 27756-27918/com.harmonicprocesses.penelopefree I/ACodec﹕ setupVideoEncoder succeeded
05-05 17:51:43.478 27756-27918/com.harmonicprocesses.penelopefree W/ACodec﹕ do not know color format 0x7f000789 = 2130708361
05-05 17:52:57.317 27756-27784/com.harmonicprocesses.penelopefree I/Adreno﹕ Native window GetBuffer failed
05-05 17:55:41.518 27756-27784/com.harmonicprocesses.penelopefree I/Adreno﹕ Failed to acquire a surface
05-05 17:56:24.246 27756-27791/com.harmonicprocesses.penelopefree V/com.hpp.MyMediaMux﹕ Trying to write data before muxer started, isAudioSample = true
05-05 18:04:55.189 27756-27784/com.harmonicprocesses.penelopefree D/io.hpp.MyGLSurfaceView18﹕ eglSwapBuffers: EGL error: 0x300d
05-05 18:04:55.189 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ java.lang.Exception
05-05 18:04:55.189 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.hpp.openGL.MyEGLWrapper.checkEglError(MyEGLWrapper.java:443)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.hpp.openGL.MyEGLWrapper.swapBuffers(MyEGLWrapper.java:314)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.harmonicprocesses.penelopefree.camera.CaptureManager.drawFrame(CaptureManager.java:478)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.harmonicprocesses.penelopefree.camera.CaptureManager.drawFrameOnInputSurface(CaptureManager.java:463)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.harmonicprocesses.penelopefree.camera.CaptureManager.videoCaptureLoop(CaptureManager.java:335)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at com.harmonicprocesses.penelopefree.camera.CaptureManager$5.run(CaptureManager.java:318)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
05-05 18:04:55.190 27756-27784/com.harmonicprocesses.penelopefree W/System.err﹕ at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
1 个解决方案
#1
0
Sweet, I got it shortly after posting this. One EGL14.eglDestroySurface(mEGLDisplay,mEGLSurface);
does not set mEGLSurface to EGL14.EGL_NO_SURFACE
like I assumed. And you wouldn't know it because I didn't post it, but MyEGLWrapper.makeCurrent() checks for this:
亲爱的,我发完这个后不久就收到了。一个EGL14.eglDestroySurface(mEGLDisplay mEGLSurface);不将mEGLSurface设置为EGL14。EGL_NO_SURFACE像我以为。你可能不知道,因为我没有发布,但MyEGLWrapper.makeCurrent()检查:
public void makeCurrent(boolean toScreen, Surface surface) {
if (toScreen) { //as opposed to toEncoder
makeScreenSurfaceCurrent();
return;
}
if (mEGLSurface.equals(EGL14.EGL_NO_SURFACE)){
mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], surface,
surfaceAttribs, 0);
checkEglError("eglCreateWindowSurface");
}
EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
checkEglError("eglMakeCurrent");
}
and two, releaseAll was set to false so mEGLSurface was not even getting destroyed...
第二,释放被设置为假,所以美格表面甚至没有被摧毁…
thanks for looking.
谢谢你看。
#1
0
Sweet, I got it shortly after posting this. One EGL14.eglDestroySurface(mEGLDisplay,mEGLSurface);
does not set mEGLSurface to EGL14.EGL_NO_SURFACE
like I assumed. And you wouldn't know it because I didn't post it, but MyEGLWrapper.makeCurrent() checks for this:
亲爱的,我发完这个后不久就收到了。一个EGL14.eglDestroySurface(mEGLDisplay mEGLSurface);不将mEGLSurface设置为EGL14。EGL_NO_SURFACE像我以为。你可能不知道,因为我没有发布,但MyEGLWrapper.makeCurrent()检查:
public void makeCurrent(boolean toScreen, Surface surface) {
if (toScreen) { //as opposed to toEncoder
makeScreenSurfaceCurrent();
return;
}
if (mEGLSurface.equals(EGL14.EGL_NO_SURFACE)){
mEGLSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, configs[0], surface,
surfaceAttribs, 0);
checkEglError("eglCreateWindowSurface");
}
EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
checkEglError("eglMakeCurrent");
}
and two, releaseAll was set to false so mEGLSurface was not even getting destroyed...
第二,释放被设置为假,所以美格表面甚至没有被摧毁…
thanks for looking.
谢谢你看。