調整releaseSurface的呼叫時機

This commit is contained in:
Raymond Yang
2023-03-09 09:06:25 +08:00
parent 2897cdca0d
commit d77fc98280
4 changed files with 17 additions and 11 deletions
@@ -32,7 +32,7 @@ class GstLibrary(context: Context) : Closeable, SurfaceHolder.Callback {
}
fun pause() {
if (!isInit) return
//if (!isInit) return
nativePause()
}
@@ -80,7 +80,7 @@ class GstLibrary(context: Context) : Closeable, SurfaceHolder.Callback {
// Called from native code. Native code calls this once it has created its pipeline and
// the main loop is running, so it is ready to accept commands.
private fun onGStreamerInitialized() {
Log.i("$TAG+$tag", "GStreamer initialized:")
Log.i("$TAG+$tag", "GStreamer Initialization complete")
if (gstCallback != null) {
gstCallback!!.onStatus(GstStatus.READY)
}
@@ -127,8 +127,6 @@ class GstLibrary(context: Context) : Closeable, SurfaceHolder.Callback {
override fun surfaceCreated(holder: SurfaceHolder) {
Log.d("$TAG+$tag", "Surface created: " + holder.surface)
Log.i("$TAG+$tag", "GStreamer surfaceCreated")
isInit = true
nativeSurfaceInit(holder.surface)
}
@@ -139,9 +137,9 @@ class GstLibrary(context: Context) : Closeable, SurfaceHolder.Callback {
override fun surfaceDestroyed(holder: SurfaceHolder) {
Log.d("$TAG+$tag", "Surface destroyed")
pause()
releaseSurface()
isInit = false
//pause()
//releaseSurface()
}
companion object {