public interface AudioDevice extends AudioDeviceCapturer, AudioDeviceRenderer
Modifier and Type | Method and Description |
---|---|
static void |
audioDeviceExecuteWorkerBlock(AudioDeviceContext audioDeviceContext,
Runnable runnable)
A utility method to execute a runnable on the media engine's worker thread asynchronously.
|
static void |
audioDeviceFormatChanged(AudioDeviceContext audioDeviceContext)
This method should be called any time the capturing or rendering format changes.
|
static void |
audioDeviceReadRenderData(AudioDeviceContext audioDeviceContext,
ByteBuffer audioSample)
This method needs to be called by
AudioDeviceRenderer to pull renderable audio data
from the media engine. |
static void |
audioDeviceWriteCaptureData(AudioDeviceContext audioDeviceContext,
ByteBuffer audioSample)
This method needs to be called by
AudioDeviceCapturer implementation to provide
captured data to the media engine. |
getCapturerFormat, onInitCapturer, onStartCapturing, onStopCapturing
getRendererFormat, onInitRenderer, onStartRendering, onStopRendering
static void audioDeviceFormatChanged(AudioDeviceContext audioDeviceContext)
AudioDeviceCapturer.onStopCapturing()
and/or AudioDeviceRenderer.onStopRendering()
and then call AudioDeviceCapturer.onStartCapturing(AudioDeviceContext)
and/or AudioDeviceRenderer.onStartRendering(AudioDeviceContext)
.audioDeviceContext
- The AudioDevice context. You should use the same context provided
in AudioDeviceCapturer.onStartCapturing(AudioDeviceContext)
and/or AudioDeviceRenderer.onStartRendering(AudioDeviceContext)
here.static void audioDeviceWriteCaptureData(AudioDeviceContext audioDeviceContext, ByteBuffer audioSample)
AudioDeviceCapturer
implementation to provide
captured data to the media engine. When AudioDeviceCapturer.onStartCapturing(AudioDeviceContext)
callback is raised, call this
method in a loop to provide captured data to media engine.audioDeviceContext
- The AudioDevice context. You should use the same context provided
in AudioDeviceCapturer.onStartCapturing(AudioDeviceContext)
and/or AudioDeviceRenderer.onStartRendering(AudioDeviceContext)
here.audioSample
- Audio data you wish to deliver.static void audioDeviceReadRenderData(AudioDeviceContext audioDeviceContext, ByteBuffer audioSample)
AudioDeviceRenderer
to pull renderable audio data
from the media engine.audioDeviceContext
- The context reference. You should use the same context provided in
AudioDeviceRenderer.onStartRendering(AudioDeviceContext)
here.audioSample
- A reference to a buffer where the signed 16-bit LPCM audio data will be
copied into.static void audioDeviceExecuteWorkerBlock(AudioDeviceContext audioDeviceContext, Runnable runnable)
AudioDevice invokes the callbacks on the media engine's worker thread. If you wish to initialize, start or stop the audio device from your application code, to avoid the thread-safety problems, you should execute code from the media engine's worker thread.
audioDeviceContext
- The AudioDevice context. You should use the same context provided
in AudioDeviceRenderer.onStartRendering(AudioDeviceContext)
or AudioDeviceCapturer.onStartCapturing(AudioDeviceContext)
here.runnable
- A block which will be executed on the media engine's worker thread.5.13.0