anbox-platform-sdk  1.22.0
Anbox Platform SDK API documentation
anbox::AudioProcessor Class Referenceabstract

AudioProcessor allows processing audio data from the Android container and perform audio processing like audio playback and recording according to different platforms. More...

#include <audio_processor.h>

+ Collaboration diagram for anbox::AudioProcessor:

Public Member Functions

 AudioProcessor ()=default
 
virtual ~AudioProcessor ()=default
 
 AudioProcessor (const AudioProcessor &)=delete
 
AudioProcessoroperator= (const AudioProcessor &)=delete
 
virtual size_t process_data (const uint8_t *data, size_t size)=0
 Process a chunk of audio data. More...
 
virtual ssize_t write_data (const uint8_t *data, size_t size)
 Write a chunk of audio data. More...
 
virtual ssize_t read_data (uint8_t *data, size_t size)
 Read a chunk of audio data. More...
 
virtual int standby (AnboxAudioStreamType type)
 Notify the platform when an audio stream is in standby mode. More...
 
virtual int activate (AnboxAudioStreamType type)
 Notify the platform when an audio stream is in activation mode. More...
 
virtual bool need_silence_on_standby () const
 Produce a silent audio stream on need while the audio output stream goes into the standby state. More...
 

Detailed Description

AudioProcessor allows processing audio data from the Android container and perform audio processing like audio playback and recording according to different platforms.

Definition at line 34 of file audio_processor.h.

Constructor & Destructor Documentation

◆ AudioProcessor() [1/2]

anbox::AudioProcessor::AudioProcessor ( )
default

◆ ~AudioProcessor()

virtual anbox::AudioProcessor::~AudioProcessor ( )
virtualdefault

◆ AudioProcessor() [2/2]

anbox::AudioProcessor::AudioProcessor ( const AudioProcessor )
delete

Member Function Documentation

◆ activate()

virtual int anbox::AudioProcessor::activate ( AnboxAudioStreamType  type)
inlinevirtual

Notify the platform when an audio stream is in activation mode.

This function will be called when an audio stream is in activation mode. If a platform is notified by Anbox that one audio stream is going to activation mode,

Parameters
typethe specified audio stream type.
Returns
0 on success or negative on failure.

Definition at line 111 of file audio_processor.h.

◆ need_silence_on_standby()

virtual bool anbox::AudioProcessor::need_silence_on_standby ( ) const
inlinevirtual

Produce a silent audio stream on need while the audio output stream goes into the standby state.

Anbox will produce a silent audio stream while the audio output stream goes into the standby state if this function returns true, otherwise returns false. Producing a silent audio stream helps with the audio latency reduction when doing audio playback if no audio output device is installed on a platform.

Returns
true when needs to produce a silent audio stream while audio output stream goes into the standby state, otherwise return false.

Definition at line 127 of file audio_processor.h.

◆ operator=()

AudioProcessor& anbox::AudioProcessor::operator= ( const AudioProcessor )
delete

◆ process_data()

virtual size_t anbox::AudioProcessor::process_data ( const uint8_t *  data,
size_t  size 
)
pure virtual

Process a chunk of audio data.

This function allows processing a single chunk of audio data. The audio data is passed by directly from the Android container to Anbox for audio playback

Parameters
dataPointer to the chunk of audio data that is passed from the anbox container.
sizethe number of bytes to be processed.
Returns
The number of bytes actually processed on success.

◆ read_data()

virtual ssize_t anbox::AudioProcessor::read_data ( uint8_t *  data,
size_t  size 
)
inlinevirtual

Read a chunk of audio data.

This function allows reading a single chunk of audio data. The audio data is passed by directly from Anbox to the Android container for audio recording

Parameters
dataPointer to the chunk of audio data that is passed from the Anbox.
sizethe number of bytes to be read.
Returns
The number of bytes actually read, otherwise returns a negative value on error

Definition at line 80 of file audio_processor.h.

◆ standby()

virtual int anbox::AudioProcessor::standby ( AnboxAudioStreamType  type)
inlinevirtual

Notify the platform when an audio stream is in standby mode.

This function will be called when an audio stream enters standby mode. If a platform is notified by Anbox that one audio stream is going to standby mode, it's always good to drain the audio buffer cached on the platform side since this reduces the accumulated latency efficiently.

Parameters
typethe specified audio stream type.
Returns
0 on success or negative on failure.

Definition at line 97 of file audio_processor.h.

◆ write_data()

virtual ssize_t anbox::AudioProcessor::write_data ( const uint8_t *  data,
size_t  size 
)
inlinevirtual

Write a chunk of audio data.

This function allows writing a single chunk of audio data. The audio data is passed by directly from the Android container to Anbox for audio playback

Parameters
dataPointer to the chunk of audio data that is passed from the anbox container.
sizethe number of bytes to be written.
Returns
The number of bytes actually written on success, otherwise returns a negative value on error

Definition at line 64 of file audio_processor.h.


The documentation for this class was generated from the following file: