Android AppRTCMobile: Use new audio device code

This CL contains some follow-up fixes for
https://webrtc-review.googlesource.com/c/src/+/60541. It removes all use
of the old voiceengine implementation from AppRTCMobile.

Bug: webrtc:7452
Change-Id: Iea21a4b3be1f3cbb5062831164fffb2c8051d858
Reviewed-on: https://webrtc-review.googlesource.com/63480
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22530}
This commit is contained in:
Magnus Jedvert
2018-03-21 11:39:29 +01:00
committed by Commit Bot
parent 82fad3d513
commit 08006d4133
6 changed files with 59 additions and 57 deletions

View File

@ -45,10 +45,56 @@ public class AudioDeviceModule {
void onWebRtcAudioRecordError(String errorMessage);
}
/**
* Contains audio sample information.
*/
public static class AudioSamples {
/** See {@link AudioRecord#getAudioFormat()} */
private final int audioFormat;
/** See {@link AudioRecord#getChannelCount()} */
private final int channelCount;
/** See {@link AudioRecord#getSampleRate()} */
private final int sampleRate;
private final byte[] data;
public AudioSamples(int audioFormat, int channelCount, int sampleRate, byte[] data) {
this.audioFormat = audioFormat;
this.channelCount = channelCount;
this.sampleRate = sampleRate;
this.data = data;
}
public int getAudioFormat() {
return audioFormat;
}
public int getChannelCount() {
return channelCount;
}
public int getSampleRate() {
return sampleRate;
}
public byte[] getData() {
return data;
}
}
/** Called when new audio samples are ready. This should only be set for debug purposes */
public static interface SamplesReadyCallback {
void onWebRtcAudioRecordSamplesReady(AudioSamples samples);
}
public static void setErrorCallback(AudioRecordErrorCallback errorCallback) {
WebRtcAudioRecord.setErrorCallback(errorCallback);
}
public static void setOnAudioSamplesReady(SamplesReadyCallback callback) {
WebRtcAudioRecord.setOnAudioSamplesReady(callback);
}
/* AudioTrack */
// Audio playout/track error handler functions.
public enum AudioTrackStartErrorCode {