Package org.webrtc.audio
Class WebRtcAudioTrack
java.lang.Object
org.webrtc.audio.WebRtcAudioTrack
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final longprivate final Objectprivate IAudioTrackListenerprivate static final intprivate static final intprivate ByteBufferprivate intprivate static final intprivate intprivate static final intprivate byte[]private final JavaAudioDeviceModule.AudioTrackErrorCallbackprivate intprivate longprivate intprivate intprivate booleanprivate final JavaAudioDeviceModule.AudioTrackStateCallbackprivate static final Stringprivate final ThreadUtils.ThreadCheckerprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionWebRtcAudioTrack(Object context, Object audioManager) WebRtcAudioTrack(Object context, Object audioManager, Object audioAttributes, JavaAudioDeviceModule.AudioTrackErrorCallback errorCallback, JavaAudioDeviceModule.AudioTrackStateCallback stateCallback, boolean useLowLatency, boolean enableVolumeLogger, IAudioTrackListener audioTrackListener) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidassertTrue(boolean condition) private voiddoAudioTrackStateCallback(int audioState) private intintintprivate intprivate intintintprivate intprivate intGet current volume level for a phone call audio stream.private intinitPlayout(int sampleRate, int channels, double bufferSizeFactor) private voidprivate static voidlogNativeOutputSampleRate(int requestedSampleRateInHz) private static voidnativeCacheDirectBufferAddress(long nativeAudioTrackJni, ByteBuffer byteBuffer) private static voidnativeGetPlayoutData(long nativeAudioTrackJni, int bytes) private voidreportWebRtcAudioTrackError(String errorMessage) private voidreportWebRtcAudioTrackInitError(String errorMessage) private voidreportWebRtcAudioTrackStartError(JavaAudioDeviceModule.AudioTrackStartErrorCode errorCode, String errorMessage) voidsetNativeAudioTrack(long nativeAudioTrack) voidsetSpeakerMute(boolean mute) private booleansetStreamVolume(int volume) private booleanprivate boolean
-
Field Details
-
TAG
- See Also:
-
BITS_PER_SAMPLE
private static final int BITS_PER_SAMPLE- See Also:
-
CALLBACK_BUFFER_SIZE_MS
private static final int CALLBACK_BUFFER_SIZE_MS- See Also:
-
BUFFERS_PER_SECOND
private static final int BUFFERS_PER_SECOND- See Also:
-
AUDIO_TRACK_THREAD_JOIN_TIMEOUT_MS
private static final long AUDIO_TRACK_THREAD_JOIN_TIMEOUT_MS- See Also:
-
DEFAULT_USAGE
private static final int DEFAULT_USAGE- See Also:
-
AUDIO_TRACK_START
private static final int AUDIO_TRACK_START- See Also:
-
AUDIO_TRACK_STOP
private static final int AUDIO_TRACK_STOP- See Also:
-
nativeAudioTrack
private long nativeAudioTrack -
threadChecker
-
byteBuffer
-
audioAttributes
-
speakerMute
private volatile boolean speakerMute -
emptyBytes
private byte[] emptyBytes -
useLowLatency
private boolean useLowLatency -
initialBufferSizeInFrames
private int initialBufferSizeInFrames -
errorCallback
-
stateCallback
-
readSizeInBytes
private int readSizeInBytes -
sampleRate
private int sampleRate -
bytesPerSample
private int bytesPerSample -
channels
private int channels -
audioTrackListener
-
-
Constructor Details
-
WebRtcAudioTrack
-
WebRtcAudioTrack
WebRtcAudioTrack(Object context, Object audioManager, @Nullable Object audioAttributes, @Nullable JavaAudioDeviceModule.AudioTrackErrorCallback errorCallback, @Nullable JavaAudioDeviceModule.AudioTrackStateCallback stateCallback, boolean useLowLatency, boolean enableVolumeLogger, IAudioTrackListener audioTrackListener)
-
-
Method Details
-
getPlayoutData
-
getReadSizeInBytes
public int getReadSizeInBytes() -
setNativeAudioTrack
public void setNativeAudioTrack(long nativeAudioTrack) -
initPlayout
private int initPlayout(int sampleRate, int channels, double bufferSizeFactor) -
startPlayout
private boolean startPlayout() -
getBytesPerSample
public int getBytesPerSample() -
stopPlayout
private boolean stopPlayout() -
getStreamMaxVolume
private int getStreamMaxVolume() -
setStreamVolume
private boolean setStreamVolume(int volume) -
getStreamVolume
private int getStreamVolume()Get current volume level for a phone call audio stream. -
GetPlayoutUnderrunCount
private int GetPlayoutUnderrunCount() -
logNativeOutputSampleRate
private static void logNativeOutputSampleRate(int requestedSampleRateInHz) -
getBufferSizeInFrames
private int getBufferSizeInFrames() -
getInitialBufferSizeInFrames
private int getInitialBufferSizeInFrames() -
logBufferCapacityInFrames
private void logBufferCapacityInFrames() -
assertTrue
private static void assertTrue(boolean condition) -
nativeCacheDirectBufferAddress
-
nativeGetPlayoutData
private static void nativeGetPlayoutData(long nativeAudioTrackJni, int bytes) -
setSpeakerMute
public void setSpeakerMute(boolean mute) -
reportWebRtcAudioTrackInitError
-
reportWebRtcAudioTrackStartError
private void reportWebRtcAudioTrackStartError(JavaAudioDeviceModule.AudioTrackStartErrorCode errorCode, String errorMessage) -
reportWebRtcAudioTrackError
-
doAudioTrackStateCallback
private void doAudioTrackStateCallback(int audioState) -
getSampleRate
public int getSampleRate() -
getChannels
public int getChannels()
-