Red5Pro Android Client SDK

 7.3.0
Core SDK for Android
com.red5pro.streaming.media.R5AudioController Class Reference

The audio controller for Red5 Pro. All R5Stream's run through this controller for both recording and playback. More...

Inherits Runnable, and IDataSource.

Classes

enum  PlaybackMode
 

Public Member Functions

R5PlaybackAudioHandler getPlaybackAudioHandler ()
 
void setPlaybackAudioHandler (R5PlaybackAudioHandler handler)
 
void setHardwareEnabled (boolean enable, Context context)
 
boolean isControllerRunning ()
 
boolean isPlaybackRunning ()
 
void StopController ()
 
void StartController ()
 
void StartRecording (R5Stream recordingStream, IDataSink handler)
 
void StopRecording ()
 
int BufferSize ()
 
void StartPlayback (R5Stream stream)
 
void StopPlayback ()
 
void InitSubController (final int localBitrate)
 
MediaFormat getMediaFormat ()
 
double getStreamtimeMill ()
 
long getAudioSampleTime ()
 
boolean isMuted ()
 
void muteAudio (boolean doMute)
 
void run ()
 
byte[] adtsHeader (int packetLength)
 
SDPTrack getSDPTrack ()
 
void setSDPTrack (SDPTrack track)
 
boolean setVolume (float volume)
 
boolean setPlaybackGain (float gain)
 
long getStartTime ()
 
String getName ()
 

Static Public Member Functions

static boolean getHardwareEnabled ()
 
static R5AudioController getInstance ()
 
static byte[] downSampleMono (byte[] buffer, float inFreq, float outFreq)
 
static int integerFloorMax (float n)
 

Public Attributes

int sampleRate = 8000
 
r5fl cfo = null
 
r5bl mdo = null
 

Static Public Attributes

static PlaybackMode mode = PlaybackMode.AEC
 

Protected Member Functions

void configureAudioCodec (MediaFormat format)
 
void nativeEncode (byte[] audio)
 

Protected Attributes

volatile boolean doRun = false
 
int sampRate
 

Detailed Description

The audio controller for Red5 Pro. All R5Stream's run through this controller for both recording and playback.

Member Function Documentation

int com.red5pro.streaming.media.R5AudioController.BufferSize ( )
inline

Minimum buffer size for AudioRecorder

Returns
buffer size for recorder
long com.red5pro.streaming.media.R5AudioController.getAudioSampleTime ( )
inline

Get current recording stream time in MS

Returns
time in MS
static boolean com.red5pro.streaming.media.R5AudioController.getHardwareEnabled ( )
inlinestatic

Get Current hardware enable status

Returns
hardware status.
static R5AudioController com.red5pro.streaming.media.R5AudioController.getInstance ( )
inlinestatic

Global singleton of the R5AudioController

Returns
instance of the R5AudioController
SDPTrack com.red5pro.streaming.media.R5AudioController.getSDPTrack ( )
inline

Current SDP track for the AudioController

Returns
long com.red5pro.streaming.media.R5AudioController.getStartTime ( )
inline

Get Starting MS of stream

Returns
starting MS
double com.red5pro.streaming.media.R5AudioController.getStreamtimeMill ( )
inline

Get current stream time for playback

Returns
boolean com.red5pro.streaming.media.R5AudioController.isControllerRunning ( )
inline

If the controller is currently processing audio (incoming or outgoing)

Returns
currently running or not.
boolean com.red5pro.streaming.media.R5AudioController.isPlaybackRunning ( )
inline

If there is currently a playback stream running on the instance

Returns
if playback is running
void com.red5pro.streaming.media.R5AudioController.nativeEncode ( byte[]  audio)
inlineprotected

Encode audio to the media codec

Parameters
audiobytes to encode
void com.red5pro.streaming.media.R5AudioController.setHardwareEnabled ( boolean  enable,
Context  context 
)
inline

Enable or disable hardware VOIP settings. Effects vary per device, use cautiously! Must be set PRIOR to publisher starting.

Parameters
enableenable the hardware VOIP settings.
contextContext for the hardware setup (Application Activity)
void com.red5pro.streaming.media.R5AudioController.setPlaybackAudioHandler ( R5PlaybackAudioHandler  handler)
inline

Sets a handler to receive and optionally manipulate the audio stream data coming in for playback before sending to output. Note, this now functions identically to the function of the same name in R5Stream

Parameters
handlerObject which will receive the callback containing the outgoing array of audio samples.

R5PlaybackAudioHandler.processAudioPlayback has these three paramaters: byte[] bytes - Array of samples of raw audio. This serves as both input and output, any modification to the array will modify the audio sent to the speakers int size - The number of samples in the array - analogous to using bytes.length double streamTimeMilliSeconds - The time since the stream began playing audio, in milliseconds

boolean com.red5pro.streaming.media.R5AudioController.setPlaybackGain ( float  gain)
inline

Backward compatibility. Same as setVolume().

Set for deprecation in SDK release v5.0.0.

void com.red5pro.streaming.media.R5AudioController.setSDPTrack ( SDPTrack  track)
inline

Set the SDP track for the audio controller for publishing.

Parameters
tracktrack to set
boolean com.red5pro.streaming.media.R5AudioController.setVolume ( float  volume)
inline

Sets the volume for the current playback.

Parameters
volumeThe desired volume, from 0.0f - 1.0f.
Returns
Flag of being able to apply the volume to the current audio track.
void com.red5pro.streaming.media.R5AudioController.StartController ( )
inline

Start the AudioController instance. Called automatically by Red5 Pro.

void com.red5pro.streaming.media.R5AudioController.StartPlayback ( R5Stream  stream)
inline

Start audio playback for a given stream. Called automatically by Red5 Pro.

Parameters
streamStream to playback audio from.
void com.red5pro.streaming.media.R5AudioController.StartRecording ( R5Stream  recordingStream,
IDataSink  handler 
)
inline

Start a recording stream for Red5Pro. Called automatically by Red5 Pro.

Parameters
recordingStreamStream to record
handlerdatasink to drain too.
void com.red5pro.streaming.media.R5AudioController.StopController ( )
inline

Stop processing all audio both incoming and outgoing

void com.red5pro.streaming.media.R5AudioController.StopPlayback ( )
inline

Stop all audio playback. Called automatically by Red5 Pro.

void com.red5pro.streaming.media.R5AudioController.StopRecording ( )
inline

Stop all recording and release recording device

Member Data Documentation

PlaybackMode com.red5pro.streaming.media.R5AudioController.mode = PlaybackMode.AEC
static

Current playback mode for the instance of the R5AudioController


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