mediastreamer2  2.10.0
Typedefs | Functions
Audio streaming API - Create and run VoIP audio streams.

Audio streaming API - Easily run audio streams from soundcard or wav files to RTP. More...

Typedefs

typedef struct _AudioStream AudioStream
 

Functions

int media_stream_set_target_network_bitrate (MediaStream *stream, int target_bitrate)
 
int media_stream_get_target_network_bitrate (const MediaStream *stream)
 
float media_stream_get_up_bw (const MediaStream *stream)
 
float media_stream_get_down_bw (const MediaStream *stream)
 
int audio_stream_start_full (AudioStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload, int jitt_comp, const char *infile, const char *outfile, MSSndCard *playcard, MSSndCard *captcard, bool_t use_ec)
 
AudioStreamaudio_stream_new (int loc_rtp_port, int loc_rtcp_port, bool_t ipv6)
 
int audio_stream_start_now (AudioStream *stream, RtpProfile *prof, const char *remip, int remport, int rem_rtcp_port, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echo_cancel)
 
void audio_stream_iterate (AudioStream *stream)
 
void audio_stream_enable_echo_limiter (AudioStream *stream, EchoLimiterType type)
 
void audio_stream_enable_gain_control (AudioStream *stream, bool_t val)
 
void audio_stream_enable_automatic_gain_control (AudioStream *stream, bool_t val)
 
void audio_stream_set_echo_canceller_params (AudioStream *st, int tail_len_ms, int delay_ms, int framesize)
 
void audio_stream_mute_rtp (AudioStream *stream, bool_t val)
 
void audio_stream_enable_noise_gate (AudioStream *stream, bool_t val)
 
void audio_stream_enable_equalizer (AudioStream *stream, bool_t enabled)
 
void audio_stream_stop (AudioStream *stream)
 
int audio_stream_send_dtmf (AudioStream *stream, char dtmf)
 

Detailed Description

Audio streaming API - Easily run audio streams from soundcard or wav files to RTP.

Typedef Documentation

typedef struct _AudioStream AudioStream

The AudioStream holds all resources to create and run typical VoIP audiostream.

Function Documentation

int media_stream_set_target_network_bitrate ( MediaStream *  stream,
int  target_bitrate 
)


For multirate codecs like OPUS, encoder output target bitrate must be set.
Encoder will compute output codec bitrate from this value.
default value is the value corresponding the rtp PayloadType

Parameters
streamstream to apply parameter on
target_bitratein bit per seconds
Returns
0 if succeed
int media_stream_get_target_network_bitrate ( const MediaStream *  stream)

get the stream target bitrate.

Parameters
streamstream to apply parameter on
target_bitratein bit per seconds
float media_stream_get_up_bw ( const MediaStream *  stream)

get current stream upload bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds
float media_stream_get_down_bw ( const MediaStream *  stream)

get current stream download bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds
int audio_stream_start_full ( AudioStream stream,
RtpProfile *  profile,
const char *  rem_rtp_ip,
int  rem_rtp_port,
const char *  rem_rtcp_ip,
int  rem_rtcp_port,
int  payload,
int  jitt_comp,
const char *  infile,
const char *  outfile,
MSSndCard playcard,
MSSndCard captcard,
bool_t  use_ec 
)

Starts an audio stream from/to local wav files or soundcards.

This method starts the processing of the audio stream, that is playing from wav file or soundcard, voice processing, encoding, sending through RTP, receiving from RTP, decoding, voice processing and wav file recording or soundcard playback.

Parameters
streaman AudioStream previously created with audio_stream_new().
profa RtpProfile containing all PayloadType possible during the audio session.
rem_rtp_ipremote IP address where to send the encoded audio.
rem_rtp_portremote IP port where to send the encoded audio.
rem_rtcp_ipremote IP address for RTCP.
rem_rtcp_portremote port for RTCP.
payload_typepayload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile.
jitt_compNominal jitter buffer size in milliseconds.
infilepath to wav file to play out (can be NULL)
outfilepath to wav file to record into (can be NULL)
playcardThe soundcard to be used for playback (can be NULL)
captcardThe soundcard to be used for catpure. (can be NULL)
echo_cancelwhether echo cancellation is to be performed.
Returns
0 if sucessful, -1 otherwise.

<This sound card has built-in echo cancellation

AudioStream* audio_stream_new ( int  loc_rtp_port,
int  loc_rtcp_port,
bool_t  ipv6 
)

Creates an AudioStream object listening on a RTP port.

Parameters
loc_rtp_portthe local UDP port to listen for RTP packets.
loc_rtcp_portthe local UDP port to listen for RTCP packets
ipv6TRUE if ipv6 must be used.
Returns
a new AudioStream.
int audio_stream_start_now ( AudioStream stream,
RtpProfile *  prof,
const char *  remip,
int  remport,
int  rem_rtcp_port,
int  payload_type,
int  jitt_comp,
MSSndCard playcard,
MSSndCard captcard,
bool_t  echo_cancel 
)

Starts an audio stream from local soundcards.

This method starts the processing of the audio stream, that is capture from soundcard, voice processing, encoding, sending through RTP, receiving from RTP, decoding, voice processing and soundcard playback.

Parameters
streaman AudioStream previously created with audio_stream_new().
profa RtpProfile containing all PayloadType possible during the audio session.
remipremote IP address where to send the encoded audio.
remportremote IP port where to send the encoded audio
rem_rtcp_portremote port for RTCP.
payload_typepayload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile.
jitt_compNominal jitter buffer size in milliseconds.
playcardThe soundcard to be used for playback
captcardThe soundcard to be used for catpure.
echo_cancelwhether echo cancellation is to be performed.
void audio_stream_iterate ( AudioStream stream)

Executes background low priority tasks related to audio processing (RTP statistics analysis). It should be called periodically, for example with an interval of 100 ms or so.

void audio_stream_enable_echo_limiter ( AudioStream stream,
EchoLimiterType  type 
)

enable echo-limiter dispositve: one MSVolume in input branch controls a MSVolume in the output branch

void audio_stream_enable_gain_control ( AudioStream stream,
bool_t  val 
)

enable gain control, to be done before start()

void audio_stream_enable_automatic_gain_control ( AudioStream stream,
bool_t  val 
)

enable automatic gain control, to be done before start()

void audio_stream_set_echo_canceller_params ( AudioStream st,
int  tail_len_ms,
int  delay_ms,
int  framesize 
)

to be done before start

void audio_stream_mute_rtp ( AudioStream stream,
bool_t  val 
)

enable/disable rtp stream

void audio_stream_enable_noise_gate ( AudioStream stream,
bool_t  val 
)

enable noise gate, must be done before start()

void audio_stream_enable_equalizer ( AudioStream stream,
bool_t  enabled 
)

enable parametric equalizer in the stream that goes to the speaker

void audio_stream_stop ( AudioStream stream)

stop the audio streaming thread and free everything

int audio_stream_send_dtmf ( AudioStream stream,
char  dtmf 
)

send a dtmf