Fix MediaRecorder crash when no data captured.

This commit is contained in:
Cody Henthorne
2022-01-03 16:33:48 -05:00
committed by Greyson Parrelli
parent 8968ef1b85
commit ae40a65924
2 changed files with 14 additions and 5 deletions

View File

@@ -37,8 +37,17 @@ public class MediaRecorderWrapper implements Recorder {
@Override
public void stop() {
recorder.stop();
recorder.release();
recorder = null;
try {
recorder.stop();
} catch (RuntimeException e) {
if (e.getClass() != RuntimeException.class) {
throw e;
} else {
Log.d(TAG, "Recording stopped with no data captured.");
}
} finally {
recorder.release();
recorder = null;
}
}
}