fix android audio service release bug

This commit is contained in:
csf 2022-03-21 14:58:07 +08:00
parent abf35ac5c3
commit 99b27b1fe4

View File

@ -271,22 +271,22 @@ class MainService : Service() {
fun stopCapture() { fun stopCapture() {
Log.d(logTag, "Stop Capture") Log.d(logTag, "Stop Capture")
_isStart = false _isStart = false
audioRecordStat = false // release video
virtualDisplay?.release() virtualDisplay?.release()
videoEncoder?.let { videoEncoder?.let {
it.signalEndOfInputStream() it.signalEndOfInputStream()
it.stop() it.stop()
it.release() it.release()
} }
audioRecorder?.startRecording()
virtualDisplay = null virtualDisplay = null
videoEncoder = null videoEncoder = null
videoData = null videoData = null
// audioRecorder 如果无法重新创建 保留服务的情况不要释放
// audioRecorder?.stop() // release audio
// audioRecorder = null audioRecordStat = false
// audioData = null audioRecorder?.release()
audioRecorder = null
minBufferSize = 0
} }
fun destroy() { fun destroy() {