Skip to content

Commit

Permalink
fix(android): race condition when calling stop recording.
Browse files Browse the repository at this point in the history
  • Loading branch information
llfbandit committed Oct 9, 2024
1 parent 3edc8cf commit b38bf12
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class MediaCodecEncoder(
codec.releaseOutputBuffer(index, false)

if ((info.flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
finish()
stopAndRelease()
}
} catch (e: Exception) {
onError(e)
Expand All @@ -175,10 +175,6 @@ class MediaCodecEncoder(
listener.onEncoderFailure(e)
}

private fun finish() {
stopAndRelease()
}

private fun stopAndRelease() {
mCodec?.stop()
mCodec?.release()
Expand Down

0 comments on commit b38bf12

Please sign in to comment.