Android MediaCodec:eglSwapBuffers:EGL错误:0x300d

所以这个问题只发生在我第二次尝试并记录时。这意味着我第一次运行MediaCodecs和Muxer时,大部分时间都可以正常工作。但是现在我希望应用更稳定。Android MediaCodec:eglSwapBuffers:EGL错误:0x300d

帮忙弄清楚什么不是被拆卸下来并正确设置。

基本上在第二轮,一切都设置很好,但是当“Renderer.drawFrame”呼吁GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);我得到的错误:I/Adreno﹕ Native window GetBuffer failed

GLES20.glFlush();被称为错误是:I/Adreno﹕ Failed to acquire a surface

总是先于当我尝试交换缓冲区时eglSwapBuffers: EGL error: 0x300d。所以有些东西没有从第一次运行中清理干净。

清理代码:

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()

public void stop(){ 

if (codec == null) return;

if (!isAudioCodec) {

videoCodecInputSurface.release();

}

codecPrimed=false;

codec.stop();

codec.release();

codec = null;

codecManager.stopMuxer(isAudioCodec);

}

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();

public void destroySurface(){ 

EGL14.eglDestroySurface(mEGLDisplay,mEGLSurface);

checkEglError("eglDestroySurace");

}

错误日志

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)

回答:

甜,我这张贴后不久,得到了它。一个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");

}

两个,releaseAll设置为false,以便mEGLSurface甚至没有被破坏掉了...

感谢您的期待。

以上是 Android MediaCodec:eglSwapBuffers:EGL错误:0x300d 的全部内容, 来源链接: utcz.com/qa/258441.html

回到顶部