Package org.webrtc.audio
Class WebRtcAudioTrack
java.lang.Object
org.webrtc.audio.WebRtcAudioTrack
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
private static final long
private final Object
private IAudioTrackListener
private static final int
private static final int
private ByteBuffer
private int
private static final int
private int
private static final int
private byte[]
private final JavaAudioDeviceModule.AudioTrackErrorCallback
private int
private long
private int
private int
private boolean
private final JavaAudioDeviceModule.AudioTrackStateCallback
private static final String
private final ThreadUtils.ThreadChecker
private boolean
-
Constructor Summary
ConstructorDescriptionWebRtcAudioTrack
(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 void
assertTrue
(boolean condition) private void
doAudioTrackStateCallback
(int audioState) private int
int
int
private int
private int
int
int
private int
private int
Get current volume level for a phone call audio stream.private int
initPlayout
(int sampleRate, int channels, double bufferSizeFactor) private void
private static void
logNativeOutputSampleRate
(int requestedSampleRateInHz) private static void
nativeCacheDirectBufferAddress
(long nativeAudioTrackJni, ByteBuffer byteBuffer) private static void
nativeGetPlayoutData
(long nativeAudioTrackJni, int bytes) private void
reportWebRtcAudioTrackError
(String errorMessage) private void
reportWebRtcAudioTrackInitError
(String errorMessage) private void
reportWebRtcAudioTrackStartError
(JavaAudioDeviceModule.AudioTrackStartErrorCode errorCode, String errorMessage) void
setNativeAudioTrack
(long nativeAudioTrack) void
setSpeakerMute
(boolean mute) private boolean
setStreamVolume
(int volume) private boolean
private 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()
-