示例#1
0
 private boolean stopRecording() {
   Logging.d(TAG, "stopRecording");
   assertTrue(audioThread != null);
   audioThread.stopThread();
   if (!ThreadUtils.joinUninterruptibly(audioThread, AUDIO_RECORD_THREAD_JOIN_TIMEOUT_MS)) {
     Logging.e(TAG, "Join of AudioRecordJavaThread timed out");
   }
   audioThread = null;
   if (effects != null) {
     effects.release();
   }
   audioRecord.release();
   audioRecord = null;
   return true;
 }
示例#2
0
 private boolean startRecording() {
   Logging.d(TAG, "startRecording");
   assertTrue(audioRecord != null);
   assertTrue(audioThread == null);
   try {
     audioRecord.startRecording();
   } catch (IllegalStateException e) {
     Logging.e(TAG, "AudioRecord.startRecording failed: " + e.getMessage());
     return false;
   }
   if (audioRecord.getRecordingState() != AudioRecord.RECORDSTATE_RECORDING) {
     Logging.e(TAG, "AudioRecord.startRecording failed");
     return false;
   }
   audioThread = new AudioRecordThread("AudioRecordJavaThread");
   audioThread.start();
   return true;
 }