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;
}
}
}

View File

@@ -87,7 +87,7 @@ public final class FeatureFlags {
private static final String DONOR_BADGES = "android.donorBadges.6";
private static final String DONOR_BADGES_DISPLAY = "android.donorBadges.display.4";
private static final String CDSH = "android.cdsh";
private static final String VOICE_NOTE_RECORDING_V2 = "android.voiceNoteRecordingV2";
private static final String VOICE_NOTE_RECORDING_V2 = "android.voiceNoteRecordingV2.2";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -432,7 +432,7 @@ public final class FeatureFlags {
/** Whether or not to use the new voice note recorder backed by MediaRecorder. */
public static boolean voiceNoteRecordingV2() {
return getBoolean(VOICE_NOTE_RECORDING_V2, true);
return getBoolean(VOICE_NOTE_RECORDING_V2, false);
}
/** Only for rendering debug info. */