mediastreamer2 5.4.130
Audio streaming API - Create and run VoIP audio streams.

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

Collaboration diagram for Audio streaming API - Create and run VoIP audio streams.:

Data Structures

struct  _MSMediaResource
struct  _MSMediaStreamIO
struct  _AudioStream
struct  _AudioStreamMixedRecvBranch

Macros

#define media_stream_is_secured   media_stream_secured
#define ms_media_resource_get_file(r)
#define ms_media_resource_get_rtp_session(r)
#define ms_media_resource_get_camera(r)
#define ms_media_resource_get_soundcard(r)
#define MS_MEDIA_STREAM_IO_INITIALIZER
#define AUDIO_STREAM_FEATURE_PLC   (1 << 0)
#define AUDIO_STREAM_FEATURE_EC   (1 << 1)
#define AUDIO_STREAM_FEATURE_EQUALIZER   (1 << 2)
#define AUDIO_STREAM_FEATURE_VOL_SND   (1 << 3)
#define AUDIO_STREAM_FEATURE_VOL_RCV   (1 << 4)
#define AUDIO_STREAM_FEATURE_DTMF   (1 << 5)
#define AUDIO_STREAM_FEATURE_DTMF_ECHO   (1 << 6)
#define AUDIO_STREAM_FEATURE_MIXED_RECORDING   (1 << 7)
#define AUDIO_STREAM_FEATURE_LOCAL_PLAYING   (1 << 8)
#define AUDIO_STREAM_FEATURE_REMOTE_PLAYING   (1 << 9)
#define AUDIO_STREAM_FEATURE_FLOW_CONTROL   (1 << 10)
#define AUDIO_STREAM_FEATURE_VAD   (1 << 11)
#define AUDIO_STREAM_FEATURE_BAUDOT   (1 << 12)
#define AUDIO_STREAM_FEATURE_ALL
#define AUDIOSTREAMVOLUMES_NOT_FOUND   INT16_MIN

Typedefs

typedef enum EchoLimiterType EchoLimiterType
typedef enum EqualizerLocation EqualizerLocation
typedef enum MSResourceType MSResourceType
typedef struct _MSMediaResource MSMediaResource
typedef struct _MSMediaStreamIO MSMediaStreamIO
typedef void(* AudioStreamIsSpeakingCallback) (void *user_pointer, uint32_t speaker_ssrc, bool_t is_speaking)
typedef void(* AudioStreamIsMutedCallback) (void *user_pointer, uint32_t speaker_ssrc, bool_t is_muted)
typedef void(* AudioStreamActiveSpeakerCallback) (void *user_pointer, uint32_t speaker_ssrc)
typedef void(* MSAudioRouteChangedCallback) (void *audioStream, bool_t needReloadSoundDevices, char *newInputPort, char *newOutputPort)
typedef struct _AudioStream AudioStream
typedef struct _AudioStreamMixedRecvBranch AudioStreamMixedRecvBranch
typedef struct _AudioStreamVolumes AudioStreamVolumes

Enumerations

enum  EchoLimiterType {
  ELInactive ,
  ELControlMic ,
  ELControlFull
}
enum  EqualizerLocation {
  MSEqualizerHP = 0 ,
  MSEqualizerMic
}
enum  MSResourceType {
  MSResourceInvalid ,
  MSResourceDefault ,
  MSResourceFile ,
  MSResourceRtp ,
  MSResourceCamera ,
  MSResourceSoundcard ,
  MSResourceVoid ,
  MSResourceItc ,
  MSResourceScreenSharing
}

Functions

bool_t media_stream_started (MediaStream *stream)
int media_stream_join_multicast_group (MediaStream *stream, const char *ip)
bool_t media_stream_dtls_supported (void)
void media_stream_enable_dtls (MediaStream *stream, const MSDtlsSrtpParams *params)
void media_stream_set_rtcp_information (MediaStream *stream, const char *cname, const char *tool)
void media_stream_get_local_rtp_stats (MediaStream *stream, rtp_stats_t *stats)
void media_stream_get_local_fec_stats (MediaStream *stream, fec_stats *stats)
int media_stream_set_dscp (MediaStream *stream, int dscp)
void media_stream_enable_adaptive_bitrate_control (MediaStream *stream, bool_t enabled)
void media_stream_set_adaptive_bitrate_algorithm (MediaStream *stream, MSQosAnalyzerAlgorithm algorithm)
void media_stream_enable_adaptive_jittcomp (MediaStream *stream, bool_t enabled)
void media_stream_set_ice_check_list (MediaStream *stream, IceCheckList *cl)
void media_stream_set_stun_allowed (MediaStream *stream, bool_t value)
bool_t media_stream_enable_srtp (MediaStream *stream, MSCryptoSuite suite, const char *snd_key, const char *rcv_key)
bool_t media_stream_secured (const MediaStream *stream)
MSSrtpKeySource media_stream_get_srtp_key_source (const MediaStream *stream, MediaStreamDir dir, bool_t is_inner)
MSCryptoSuite media_stream_get_srtp_crypto_suite (const MediaStream *stream, MediaStreamDir dir, bool_t is_inner)
MSSrtpKeySource ms_media_stream_sessions_get_srtp_key_source (const MSMediaStreamSessions *sessions, MediaStreamDir dir, bool_t is_inner)
MSCryptoSuite ms_media_stream_sessions_get_srtp_crypto_suite (const MSMediaStreamSessions *sessions, MediaStreamDir dir, bool_t is_inner)
bool_t media_stream_avpf_enabled (const MediaStream *stream)
uint16_t media_stream_get_avpf_rr_interval (const MediaStream *stream)
RtpSession * media_stream_get_rtp_session (const MediaStream *stream)
const MSQualityIndicator * media_stream_get_quality_indicator (MediaStream *stream)
float media_stream_get_quality_rating (MediaStream *stream)
float media_stream_get_average_quality_rating (MediaStream *stream)
float media_stream_get_lq_quality_rating (MediaStream *stream)
float media_stream_get_average_lq_quality_rating (MediaStream *stream)
int media_stream_set_target_network_bitrate (MediaStream *stream, int target_bitrate)
int media_stream_set_max_network_bitrate (MediaStream *stream, int max_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)
float media_stream_get_fec_up_bw (const MediaStream *stream)
float media_stream_get_fec_down_bw (const MediaStream *stream)
float media_stream_get_rtcp_up_bw (const MediaStream *stream)
float media_stream_get_rtcp_down_bw (const MediaStream *stream)
void media_stream_reclaim_sessions (MediaStream *stream, MSMediaStreamSessions *sessions)
void media_stream_iterate (MediaStream *stream)
void media_stream_set_direction (MediaStream *stream, MediaStreamDir dir)
MediaStreamDir media_stream_get_direction (const MediaStream *stream)
bool_t media_stream_alive (MediaStream *stream, int timeout_seconds)
MSStreamState media_stream_get_state (const MediaStream *stream)
OrtpEvDispatcher * media_stream_get_event_dispatcher (const MediaStream *stream)
uint32_t media_stream_get_recv_ssrc (const MediaStream *stream)
FecParams * media_stream_extract_fec_params (const PayloadType *fec_payload_type)
void media_stream_create_or_update_fec_session (MediaStream *ms)
void media_stream_destroy_fec_stream (MediaStream *ms)
bool_t media_stream_fec_enabled (MediaStream *stream)
uint32_t media_stream_get_send_ssrc (const MediaStream *stream)
void media_stream_enable_conference_local_mix (MediaStream *stream, bool_t enabled)
void media_stream_enable_transfer_mode (MediaStream *stream, bool_t enable)
const char * ms_resource_type_to_string (MSResourceType type)
bool_t ms_media_resource_is_consistent (const MSMediaResource *r)
bool_t ms_media_stream_io_is_consistent (const MSMediaStreamIO *io)
AudioStream * audio_stream_start (MSFactory *factory, RtpProfile *prof, int locport, const char *remip, int remport, int payload_type, int jitt_comp, bool_t echo_cancel)
AudioStream * audio_stream_start_with_sndcards (MSFactory *factory, RtpProfile *prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echocancel)
int audio_stream_start_with_files (AudioStream *stream, RtpProfile *prof, const char *remip, int remport, int rem_rtcp_port, int pt, int jitt_comp, const char *infile, const char *outfile)
int audio_stream_start_from_io (AudioStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port, const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const MSMediaStreamIO *io)
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)
void audio_stream_play (AudioStream *st, const char *name)
void audio_stream_record (AudioStream *st, const char *name)
void audio_stream_play_received_dtmfs (AudioStream *st, bool_t yesno)
AudioStream * audio_stream_new (MSFactory *factory, int loc_rtp_port, int loc_rtcp_port, bool_t ipv6)
AudioStream * audio_stream_new2 (MSFactory *factory, const char *ip, int loc_rtp_port, int loc_rtcp_port)
AudioStream * audio_stream_new_with_sessions (MSFactory *factory, const MSMediaStreamSessions *sessions)
uint32_t audio_stream_get_features (AudioStream *st)
void audio_stream_set_features (AudioStream *st, uint32_t features)
void audio_stream_prepare_sound (AudioStream *st, MSSndCard *playcard, MSSndCard *captcard)
void audio_stream_unprepare_sound (AudioStream *st)
bool_t audio_stream_started (AudioStream *stream)
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_set_relay_session_id (AudioStream *stream, const char *relay_session_id)
bool_t audio_stream_alive (AudioStream *stream, int timeout)
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_enable_echo_canceller (AudioStream *st, bool_t enabled)
void audio_stream_force_software_echo_canceller (AudioStream *st, bool_t force)
void audio_stream_disable_record_on_mute (AudioStream *stream, bool_t disable)
void audio_stream_enable_mic (AudioStream *stream, bool_t enable)
void audio_stream_set_mic_gain_db (AudioStream *stream, float gain_db)
void audio_stream_set_mic_gain (AudioStream *stream, float gain)
void audio_stream_mute_rtp (AudioStream *stream, bool_t val)
void audio_stream_set_spk_gain_db (AudioStream *stream, float gain_db)
void audio_stream_set_spk_gain (AudioStream *stream, float gain)
void audio_stream_set_sound_card_input_gain (AudioStream *stream, float gain)
float audio_stream_get_sound_card_input_gain (const AudioStream *stream)
void audio_stream_set_sound_card_output_gain (AudioStream *stream, float volume)
float audio_stream_get_sound_card_output_gain (const AudioStream *stream)
void audio_stream_enable_noise_gate (AudioStream *stream, bool_t val)
void audio_stream_enable_equalizer (AudioStream *stream, EqualizerLocation location, bool_t enabled)
void audio_stream_equalizer_set_gain (AudioStream *stream, EqualizerLocation location, const MSEqualizerGain *gain)
void audio_stream_stop (AudioStream *stream)
int audio_stream_send_dtmf (AudioStream *stream, char dtmf)
bool_t audio_stream_supports_telephone_events (AudioStream *stream)
MSFilter * audio_stream_get_local_player (AudioStream *stream)
int audio_stream_set_mixed_record_file (AudioStream *st, const char *filename)
int audio_stream_mixed_record_start (AudioStream *st)
int audio_stream_mixed_record_stop (AudioStream *st)
MSFilter * audio_stream_open_remote_play (AudioStream *stream, const char *filename)
void audio_stream_close_remote_play (AudioStream *stream)
void audio_stream_set_default_card (int cardindex)
float audio_stream_get_quality_rating (AudioStream *stream)
float audio_stream_get_average_quality_rating (AudioStream *stream)
float audio_stream_get_lq_quality_rating (AudioStream *stream)
float audio_stream_get_average_lq_quality_rating (AudioStream *stream)
void audio_stream_enable_zrtp (AudioStream *stream, MSZrtpParams *params)
void audio_stream_start_zrtp (AudioStream *stream)
bool_t audio_stream_zrtp_enabled (const AudioStream *stream)
void audio_stream_set_mixer_to_client_extension_id (AudioStream *stream, int extension_id)
void audio_stream_set_client_to_mixer_extension_id (AudioStream *stream, int extension_id)
void audio_stream_set_is_speaking_callback (AudioStream *s, AudioStreamIsSpeakingCallback cb, void *user_pointer)
void audio_stream_set_is_muted_callback (AudioStream *s, AudioStreamIsMutedCallback cb, void *user_pointer)
void audio_stream_set_active_speaker_callback (AudioStream *s, AudioStreamActiveSpeakerCallback cb, void *user_pointer)
int audio_stream_get_participant_volume (const AudioStream *stream, uint32_t participant_ssrc)
uint32_t audio_stream_get_recv_ssrc (const AudioStream *stream)
uint32_t audio_stream_get_send_ssrc (const AudioStream *stream)
AudioStreamVolumes * audio_stream_volumes_new (void)
void audio_stream_volumes_delete (AudioStreamVolumes *volumes)
void audio_stream_volumes_insert (AudioStreamVolumes *volumes, uint32_t ssrc, int volume)
void audio_stream_volumes_erase (AudioStreamVolumes *volumes, uint32_t ssrc)
void audio_stream_volumes_clear (AudioStreamVolumes *volumes)
int audio_stream_volumes_size (AudioStreamVolumes *volumes)
int audio_stream_volumes_find (AudioStreamVolumes *volumes, uint32_t ssrc)
int audio_stream_volumes_append (AudioStreamVolumes *volumes, AudioStreamVolumes *append)
void audio_stream_volumes_reset_values (AudioStreamVolumes *volumes)
void audio_stream_volumes_populate_audio_levels (AudioStreamVolumes *volumes, rtp_audio_level_t *audio_levels)
bool_t audio_stream_volumes_is_speaking (AudioStreamVolumes *volumes)
uint32_t audio_stream_volumes_get_best (AudioStreamVolumes *volumes)
void audio_stream_set_audio_route (AudioStream *stream, MSAudioRoute route)
void audio_stream_set_audio_route_changed_callback (AudioStream *stream, MSAudioRouteChangedCallback callback, void *audio_route_changed_cb_user_data)
int audio_stream_set_input_ms_snd_card (AudioStream *stream, MSSndCard *sndcard_capture)
int audio_stream_set_output_ms_snd_card (AudioStream *stream, MSSndCard *sndcard_playback)
MSSndCard * audio_stream_get_input_ms_snd_card (AudioStream *stream)
MSSndCard * audio_stream_get_output_ms_snd_card (AudioStream *stream)
void audio_stream_send_baudot_character (AudioStream *stream, const char c)
void audio_stream_send_baudot_string (AudioStream *stream, const char *text)
void audio_stream_enable_baudot_decoding (AudioStream *stream, bool_t enabled)
void audio_stream_set_baudot_sending_mode (AudioStream *stream, MSBaudotMode mode)
void audio_stream_set_baudot_pause_timeout (AudioStream *stream, uint8_t seconds)
void audio_stream_enable_baudot_detection (AudioStream *stream, bool_t enabled)

Detailed Description

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

Macro Definition Documentation

◆ AUDIO_STREAM_FEATURE_ALL

#define AUDIO_STREAM_FEATURE_ALL
Value:
(AUDIO_STREAM_FEATURE_PLC | AUDIO_STREAM_FEATURE_EC | AUDIO_STREAM_FEATURE_EQUALIZER | \
AUDIO_STREAM_FEATURE_VOL_SND | AUDIO_STREAM_FEATURE_VOL_RCV | AUDIO_STREAM_FEATURE_DTMF | \
AUDIO_STREAM_FEATURE_DTMF_ECHO | AUDIO_STREAM_FEATURE_MIXED_RECORDING | AUDIO_STREAM_FEATURE_LOCAL_PLAYING | \
AUDIO_STREAM_FEATURE_REMOTE_PLAYING | AUDIO_STREAM_FEATURE_FLOW_CONTROL | AUDIO_STREAM_FEATURE_BAUDOT)

◆ ms_media_resource_get_camera

#define ms_media_resource_get_camera ( r)
Value:
(((r)->type == MSResourceCamera) ? (r)->camera : NULL)

◆ ms_media_resource_get_file

#define ms_media_resource_get_file ( r)
Value:
(((r)->type == MSResourceFile) ? (r)->file : NULL)

◆ ms_media_resource_get_rtp_session

#define ms_media_resource_get_rtp_session ( r)
Value:
(((r)->type == MSResourceRtp) ? (r)->session : NULL)

◆ ms_media_resource_get_soundcard

#define ms_media_resource_get_soundcard ( r)
Value:
(((r)->type == MSResourceSoundcard) ? (r)->soundcard : NULL)

◆ MS_MEDIA_STREAM_IO_INITIALIZER

#define MS_MEDIA_STREAM_IO_INITIALIZER
Value:
{ \
{MSResourceInvalid}, { \
MSResourceInvalid \
} \
}

Typedef Documentation

◆ AudioStream

typedef struct _AudioStream AudioStream

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

◆ AudioStreamMixedRecvBranch

Structure to store an input branch added to an audiostream by conference local mixing upon reception of a new stream

◆ MSMediaResource

Structure describing the input or the output of a MediaStream. type must be set to one the member of the MSResourceType enum, and the correspoding resource argument must be set: the file name (const char*) for MSResourceFile, the RtpSession for MSResourceRtp, an MSWebCam for MSResourceCamera, an MSSndCard for MSResourceSoundcard, an MSFilter for MSResourceItc, an MSScreenSharingDesc for MSResourceScreenSharing

Warning
due to implementation, if RTP is to be used for input and output, the same RtpSession must be passed for both sides.

◆ MSMediaStreamIO

Structure describing the input/output of a MediaStream. Input and output are described as MSMediaResource.

Function Documentation

◆ audio_stream_disable_record_on_mute()

void audio_stream_disable_record_on_mute ( AudioStream * stream,
bool_t disable )

Calling this method with disable=true will cause the microhone to be completely deactivated when muted Currently only implemented for IOS, this will cause the playback sound to be interrupted for a short moment while the audio is reconfigured. On IOS 14, it will also disable Apple's microphone recording indicator when microphone is muted.

Parameters
streamThe stream.
disableTrue if you wish to entirely stop the audio recording when muting the microphone.

◆ audio_stream_enable_automatic_gain_control()

void audio_stream_enable_automatic_gain_control ( AudioStream * stream,
bool_t val )

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

◆ audio_stream_enable_baudot_decoding()

void audio_stream_enable_baudot_decoding ( AudioStream * stream,
bool_t enabled )

Enable/disable Baudot tones decoding.

Parameters
[in]streamThe AudioStream object
[in]enabledWhether to enable or disable Baudot tones decoding.

◆ audio_stream_enable_baudot_detection()

void audio_stream_enable_baudot_detection ( AudioStream * stream,
bool_t enabled )

Enable/disable Baudot tones detection.

Parameters
[in]streamThe AudioStream object
[in]enabledWhether to enable or disable Baudot tones detection.

◆ audio_stream_enable_echo_canceller()

void audio_stream_enable_echo_canceller ( AudioStream * st,
bool_t enabled )

to be done before start

◆ audio_stream_enable_echo_limiter()

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

◆ audio_stream_enable_equalizer()

void audio_stream_enable_equalizer ( AudioStream * stream,
EqualizerLocation location,
bool_t enabled )

Enable a parametric equalizer

Parameters
[in]streamAn AudioStream
[in]locationLocation of the equalizer to enable (speaker or microphone)
[in]enabledWhether the equalizer must be enabled

◆ audio_stream_enable_gain_control()

void audio_stream_enable_gain_control ( AudioStream * stream,
bool_t val )

enable gain control, to be done before start()

◆ audio_stream_enable_mic()

void audio_stream_enable_mic ( AudioStream * stream,
bool_t enable )

Mute or unmute the microphone For IOS, if "audio_stream_disable_record_on_mute" was enabled, this will completely stop the microphone recording. Else, sound recording remains active but silence is sent instead of recorded audiow@

Parameters
streamThe stream.
enableWether the microphone must be enabled.

◆ audio_stream_enable_noise_gate()

void audio_stream_enable_noise_gate ( AudioStream * stream,
bool_t val )

enable noise gate, must be done before start()

◆ audio_stream_equalizer_set_gain()

void audio_stream_equalizer_set_gain ( AudioStream * stream,
EqualizerLocation location,
const MSEqualizerGain * gain )

Apply a gain on a given frequency band.

Parameters
[in]streamAn AudioStream
[in]locationLocation of the concerned equalizer (speaker or microphone)
[in]gainDescription of the band and the gain to apply.

◆ audio_stream_force_software_echo_canceller()

void audio_stream_force_software_echo_canceller ( AudioStream * st,
bool_t force )

Forces the use of a software echo canceller if available instead of hardwared/built-in one.

◆ audio_stream_get_input_ms_snd_card()

MSSndCard * audio_stream_get_input_ms_snd_card ( AudioStream * stream)

Retrieve the current sound card from the audio capture filter (currently only used for AAudio and OpenSLES)

Parameters
[in]streamThe AudioStream object

◆ audio_stream_get_output_ms_snd_card()

MSSndCard * audio_stream_get_output_ms_snd_card ( AudioStream * stream)

Retrieve the current sound card from the audio playback filter (currently only used for AAudio and OpenSLES)

Parameters
[in]streamThe AudioStream object

◆ audio_stream_get_participant_volume()

int audio_stream_get_participant_volume ( const AudioStream * stream,
uint32_t participant_ssrc )

Retrieve the volume of the given participant.

Parameters
streamthe audio stream
participant_ssrcthe ssrc of the participant
Returns
the volume of the participant in dbm0, if participant isn't found it will return the lowest volume.

◆ audio_stream_get_recv_ssrc()

uint32_t audio_stream_get_recv_ssrc ( const AudioStream * stream)

Retrieve the receive ssrc of the stream

Parameters
streamthe audio stream
Returns
the receive ssrc of the stream

◆ audio_stream_get_send_ssrc()

uint32_t audio_stream_get_send_ssrc ( const AudioStream * stream)

Retrieve the send ssrc of the stream

Parameters
streamthe audio stream
Returns
the send ssrc of the stream

◆ audio_stream_get_sound_card_input_gain()

float audio_stream_get_sound_card_input_gain ( const AudioStream * stream)

Get microphone volume gain.

Parameters
streamThe audio stream.
Returns
double Volume gain in percentage of the max suppored gain. Valid returned values are in [0.0 : 1.0]. A negative value is returned in case of failure.

◆ audio_stream_get_sound_card_output_gain()

float audio_stream_get_sound_card_output_gain ( const AudioStream * stream)

Get speaker volume gain.

Parameters
streamThe audio stream.
Returns
Volume gain in percentage of the max suppored gain. Valid returned values are in [0.0 : 1.0]. A negative value is returned in case of failure.

◆ audio_stream_iterate()

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.

◆ audio_stream_mute_rtp()

void audio_stream_mute_rtp ( AudioStream * stream,
bool_t val )

enable/disable rtp stream

◆ audio_stream_new()

AudioStream * audio_stream_new ( MSFactory * factory,
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.
factory
Returns
a new AudioStream.

◆ audio_stream_new2()

AudioStream * audio_stream_new2 ( MSFactory * factory,
const char * ip,
int loc_rtp_port,
int loc_rtcp_port )

Creates an AudioStream object listening on a RTP port for a dedicated address.

Parameters
loc_ipthe local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
loc_rtp_portthe local UDP port to listen for RTP packets.
loc_rtcp_portthe local UDP port to listen for RTCP packets
factory
Returns
a new AudioStream.

◆ audio_stream_new_with_sessions()

AudioStream * audio_stream_new_with_sessions ( MSFactory * factory,
const MSMediaStreamSessions * sessions )

Creates an AudioStream object from initialized MSMediaStreamSessions.

Parameters
sessionsthe MSMediaStreamSessions
factorythe MSFActory from the core object
Returns
a new AudioStream

◆ audio_stream_open_remote_play()

MSFilter * audio_stream_open_remote_play ( AudioStream * stream,
const char * filename )

Open a player to play an audio/video file to remote end. The player is returned as a MSFilter so that application can make usual player controls on it using the MSPlayerInterface.

◆ audio_stream_send_baudot_character()

void audio_stream_send_baudot_character ( AudioStream * stream,
const char c )

Send character as Baudot tones on the audio stream.

Parameters
[in]streamThe AudioStream object
[in]cThe character to be sent

◆ audio_stream_send_baudot_string()

void audio_stream_send_baudot_string ( AudioStream * stream,
const char * text )

Send text as Baudot tones on the audio stream.

Parameters
[in]streamThe AudioStream object
[in]textThe text to be sent

◆ audio_stream_send_dtmf()

int audio_stream_send_dtmf ( AudioStream * stream,
char dtmf )

send a dtmf

◆ audio_stream_set_audio_route()

void audio_stream_set_audio_route ( AudioStream * stream,
MSAudioRoute route )

Asks the audio playback filter to route to the selected device (currently only used for blackberry)

Parameters
[in]streamThe AudioStream object
[in]routeThe wanted audio output device (earpiece, speaker)

◆ audio_stream_set_audio_route_changed_callback()

void audio_stream_set_audio_route_changed_callback ( AudioStream * stream,
MSAudioRouteChangedCallback callback,
void * audio_route_changed_cb_user_data )

Set a callback to be called when an audio route change is notified (IOS only)

Parameters
[in]streamThe AudioStream object
[in]callbackThe function to call when receiving the route change event
[in]audio_route_changed_cb_user_dataContext for the callback

◆ audio_stream_set_baudot_pause_timeout()

void audio_stream_set_baudot_pause_timeout ( AudioStream * stream,
uint8_t seconds )

Set the Baudot significant pause timeout after which a LETTERS tone is retransmitted before resuming transmission (in seconds). Default is 5s.

Parameters
[in]streamThe AudioStream object
[in]secondsThe significant pause timeout in seconds.

◆ audio_stream_set_baudot_sending_mode()

void audio_stream_set_baudot_sending_mode ( AudioStream * stream,
MSBaudotMode mode )

Set the Baudot mode to use in the sending_path.

Parameters
[in]streamThe AudioStream object
[in]modeThe Baudot mode to use in the sending path.

◆ audio_stream_set_client_to_mixer_extension_id()

void audio_stream_set_client_to_mixer_extension_id ( AudioStream * stream,
int extension_id )

Sets the header extension id for client to mixer audio level indication. This has to be called before starting the audio stream.

Parameters
streamthe audio stream
extension_idthe extension id

◆ audio_stream_set_echo_canceller_params()

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

to be done before start

◆ audio_stream_set_input_ms_snd_card()

int audio_stream_set_input_ms_snd_card ( AudioStream * stream,
MSSndCard * sndcard_capture )

Asks the audio capture filter to route to the selected sound card (currently only used for AAudio and OpenSLES)

Parameters
[in]streamThe AudioStream object
[in]sndcard_captureThe wanted audio input soundcard
Returns
'0' if MS_AUDIO_CAPTURE_SET_INTERNAL_ID has been successfully called, '-1' if not

◆ audio_stream_set_mic_gain()

void audio_stream_set_mic_gain ( AudioStream * stream,
float gain )
Deprecated
Like audio_stream_set_mic_gain_db() excepted that the gain is specified in percentage.
Parameters
streamThe stream.
gainGain to apply in percentage of the max supported gain.

◆ audio_stream_set_mic_gain_db()

void audio_stream_set_mic_gain_db ( AudioStream * stream,
float gain_db )

Apply a software gain on the microphone. Be note that this method neither changes the volume gain of the sound card nor the system mixer one. If you intends to control the volume gain at sound card level, you should use audio_stream_set_sound_card_input_gain() instead.

Parameters
streamThe stream.
gain_dbGain to apply in dB.

◆ audio_stream_set_mixer_to_client_extension_id()

void audio_stream_set_mixer_to_client_extension_id ( AudioStream * stream,
int extension_id )

Sets the header extension id for mixer to client audio level indication. This has to be called before starting the audio stream.

Parameters
streamthe audio stream
extension_idthe extension id

◆ audio_stream_set_output_ms_snd_card()

int audio_stream_set_output_ms_snd_card ( AudioStream * stream,
MSSndCard * sndcard_playback )

Asks the audio playback filter to route to the selected sound card (currently only used for AAudio and OpenSLES)

Parameters
[in]streamThe AudioStream object
[in]sndcard_playbackThe wanted audio output soundcard
Returns
'0' if MS_AUDIO_PLAYBACK_SET_INTERNAL_ID has been successfully called, '-1' if not

◆ audio_stream_set_sound_card_input_gain()

void audio_stream_set_sound_card_input_gain ( AudioStream * stream,
float gain )

Set microphone volume gain. If the sound backend supports it, the set volume gain will be synchronized with the host system mixer. If you intended to apply a static software gain, you should use audio_stream_set_mic_gain_db() or audio_stream_set_mic_gain().

Parameters
streamThe audio stream.
gainPercentage of the max supported volume gain. Valid values are in [0.0 : 1.0].

◆ audio_stream_set_sound_card_output_gain()

void audio_stream_set_sound_card_output_gain ( AudioStream * stream,
float volume )

Set speaker volume gain. If the sound backend supports it, the set volume gain will be synchronized with the host system mixer.

Parameters
streamThe audio stream.
gainPercentage of the max supported volume gain. Valid values are in [0.0 : 1.0].

◆ audio_stream_set_spk_gain()

void audio_stream_set_spk_gain ( AudioStream * stream,
float gain )

Like audio_stream_set_spk_gain_db() excepted that the gain is specified in percentage.

Parameters
streamThe stream.
gainGain to apply in percentage of the max supported gain.

◆ audio_stream_set_spk_gain_db()

void audio_stream_set_spk_gain_db ( AudioStream * stream,
float gain_db )

Apply a gain on received RTP packets.

Parameters
streamAn AudioStream.
gain_dbGain to apply in dB.

◆ audio_stream_start_from_io()

int audio_stream_start_from_io ( AudioStream * stream,
RtpProfile * profile,
const char * rem_rtp_ip,
int rem_rtp_port,
const char * rem_rtcp_ip,
int rem_rtcp_port,
int payload_type,
const MSMediaStreamIO * io )

Start an audio stream according to the specified AudioStreamIO.

Parameters
[in]streamAudioStream object previously created with audio_stream_new().
[in]profileRtpProfile object holding the PayloadType that can be used during the audio session.
[in]rem_rtp_ipThe remote IP address where to send the encoded audio to.
[in]rem_rtp_portThe remote port where to send the encoded audio to.
[in]rem_rtcp_ipThe remote IP address for RTCP.
[in]rem_rtcp_portThe remote port for RTCP.
[in]payload_typeThe payload type number used to send the audio stream. A valid PayloadType must be available at this index in the profile.
[in]ioA MSMediaStreamIO describing the local input/output of the audio stream.

◆ audio_stream_start_full()

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().
profilea 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.
payloadpayload 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)
use_ecwhether echo cancellation is to be performed.
Returns
0 if sucessful, -1 otherwise.

◆ audio_stream_start_now()

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.

◆ audio_stream_stop()

void audio_stream_stop ( AudioStream * stream)

stop the audio streaming thread and free everything

◆ audio_stream_supports_telephone_events()

bool_t audio_stream_supports_telephone_events ( AudioStream * stream)

Are telephone events supported? Used to determine if DTMFs can be sent out-of-band

◆ audio_stream_zrtp_enabled()

bool_t audio_stream_zrtp_enabled ( const AudioStream * stream)

return TRUE if zrtp is enabled, it does not mean that stream is encrypted, but only that zrtp is configured to know encryption status, uses #

◆ media_stream_alive()

bool_t media_stream_alive ( MediaStream * stream,
int timeout_seconds )

Returns TRUE if stream was still actively receiving packets (RTP or RTCP) in the last period specified in timeout_seconds.

◆ media_stream_avpf_enabled()

bool_t media_stream_avpf_enabled ( const MediaStream * stream)

Tells whether AVPF is enabled or not.

Parameters
[in]streamMediaStream object.
Returns
True if AVPF is enabled, false otherwise.

◆ media_stream_create_or_update_fec_session()

void media_stream_create_or_update_fec_session ( MediaStream * ms)

Create a RTP session with a FEC stream for flexible FEC. The source session is the one given in ms. The rtp bundle mode must be enabled.

Parameters
streamthe media stream

◆ media_stream_destroy_fec_stream()

void media_stream_destroy_fec_stream ( MediaStream * ms)

Destroy the FEC stream of the RTP session of the media stream. The FEC session remains.

Parameters
streamthe media stream

◆ media_stream_enable_conference_local_mix()

void media_stream_enable_conference_local_mix ( MediaStream * stream,
bool_t enabled )

Enable/Disable the local conference mix capabilities. Enable it when the conference server is doing session transfer forwarding whole RTP packet not just the payload On a videostream: force instant resync on incoming SSRC change: so the active speaker session is able to switch from one session to another instantly On an audiostream: allow creation of bundled RtpSession upon reception of a new SSRC

Do this setting before start

◆ media_stream_enable_transfer_mode()

void media_stream_enable_transfer_mode ( MediaStream * stream,
bool_t enable )

When the stream is in transfer mode, new RTP Sessions are generated when a new SSRC is detected in an outgoing packet to be done before start

◆ media_stream_extract_fec_params()

FecParams * media_stream_extract_fec_params ( const PayloadType * fec_payload_type)

Returns the parameters for flexible FEC.

Parameters
fec_payload_typethe payload type for flexible FEC
Returns
the parameters for flexible FEC

◆ media_stream_fec_enabled()

bool_t media_stream_fec_enabled ( MediaStream * stream)

Ask the media stream if it has a flexible FEC stream. Note: the FEC stream can exist and be inactive if the FEC parameters L and D are set to 0 (no repair packets are sent nor received).

Parameters
[in]streamThe media stream object.
Returns
true if the media stream has a FEC stream, false otherwise.

◆ media_stream_get_avpf_rr_interval()

uint16_t media_stream_get_avpf_rr_interval ( const MediaStream * stream)

Gets the AVPF Regular RTCP report interval.

Parameters
[in]streamMediaStream object.
Returns
The AVPF Regular RTCP report interval in seconds.

◆ media_stream_get_down_bw()

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

◆ media_stream_get_fec_down_bw()

float media_stream_get_fec_down_bw ( const MediaStream * stream)

get current FEC stream download bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds

◆ media_stream_get_fec_up_bw()

float media_stream_get_fec_up_bw ( const MediaStream * stream)

get current FEC stream upload bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds

◆ media_stream_get_recv_ssrc()

uint32_t media_stream_get_recv_ssrc ( const MediaStream * stream)

Retrieve the receive ssrc of the stream

Parameters
streamthe media stream
Returns
the receive ssrc of the stream

◆ media_stream_get_rtcp_down_bw()

float media_stream_get_rtcp_down_bw ( const MediaStream * stream)

get current stream rtcp download bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds

◆ media_stream_get_rtcp_up_bw()

float media_stream_get_rtcp_up_bw ( const MediaStream * stream)

get current stream rtcp upload bitrate. Value is updated every seconds

Parameters
stream
Returns
bitrate in bit per seconds

◆ media_stream_get_rtp_session()

RtpSession * media_stream_get_rtp_session ( const MediaStream * stream)

Gets the RTP session of the media stream.

Parameters
[in]streamMediaStream object.
Returns
The RTP session of the media stream.

◆ media_stream_get_send_ssrc()

uint32_t media_stream_get_send_ssrc ( const MediaStream * stream)

Retrieve the send ssrc of the stream

Parameters
streamthe media stream
Returns
the send ssrc of the stream

◆ media_stream_get_srtp_crypto_suite()

MSCryptoSuite media_stream_get_srtp_crypto_suite ( const MediaStream * stream,
MediaStreamDir dir,
bool_t is_inner )

Get the crypto suite used to secure this stream

Parameters
[in]streamMediaStream object
[in]dirstream direction (send, recv or both)
[in]is_innerget the suite of the inner encrytion if true
Returns
the srtp key crypto suite if they are consistent: both direction (send and receive) have the same suite when dir is both MS_CRYPTO_SUITE_INVALID otherwise

◆ media_stream_get_srtp_key_source()

MSSrtpKeySource media_stream_get_srtp_key_source ( const MediaStream * stream,
MediaStreamDir dir,
bool_t is_inner )

Get the source(SDES, ZRTP, DTLS-SRTP) of srtp key used to secure this stream

Parameters
[in]streamMediaStream object
[in]dirstream direction (send, recv or both)
[in]is_innerget the source of the inner encrytion if true
Returns
the srtp key source if they are consistent: both direction (send and receive) have the same source when dir is both MSSrtpKeySourceUnavailable otherwise

◆ media_stream_get_state()

MSStreamState media_stream_get_state ( const MediaStream * stream)
Returns
current streams state

◆ media_stream_get_target_network_bitrate()

int media_stream_get_target_network_bitrate ( const MediaStream * stream)

get the stream target bitrate.

Parameters
streamstream to apply parameter on
Returns
target_bitrate in bit per seconds

◆ media_stream_get_up_bw()

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

◆ media_stream_reclaim_sessions()

void media_stream_reclaim_sessions ( MediaStream * stream,
MSMediaStreamSessions * sessions )

Returns the sessions that were used in the media stream (RTP, SRTP, ZRTP...) so that they can be re-used. As a result of calling this function, the media stream no longer owns the sessions and thus will not free them.

◆ media_stream_secured()

bool_t media_stream_secured ( const MediaStream * stream)
Parameters
[in]streamMediaStream object
Returns
true if stream is encrypted

◆ media_stream_set_max_network_bitrate()

int media_stream_set_max_network_bitrate ( MediaStream * stream,
int max_bitrate )

Set a maximum target bitrate for the stream. Indeed, the MSBandwidthController may adapt the target bitrate according to network conditions, which includes the possibility to increase it if remote side sends a TMMBR to invite to increase bitrate. The max_network_bitrate defines the upper limit for increasing the bitrate usage automatically.

Parameters
streamstream to apply parameter on
target_bitratein bit per seconds

◆ media_stream_set_target_network_bitrate()

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

◆ ms_media_stream_sessions_get_srtp_crypto_suite()

MSCryptoSuite ms_media_stream_sessions_get_srtp_crypto_suite ( const MSMediaStreamSessions * sessions,
MediaStreamDir dir,
bool_t is_inner )

Get the crypto suite used to secure this stream

Parameters
[in]stream_sessionsPointer to the stream session structure
[in]dirstream direction (send, recv or both)
[in]is_innerget the suite of the inner encrytion if true
Returns
the srtp key crypto suite if they are consistent: both direction (send and receive) have the same source when dir is both MS_CRYPTO_SUITE_INVALID otherwise

◆ ms_media_stream_sessions_get_srtp_key_source()

MSSrtpKeySource ms_media_stream_sessions_get_srtp_key_source ( const MSMediaStreamSessions * sessions,
MediaStreamDir dir,
bool_t is_inner )

Get the source(SDES, ZRTP, DTLS-SRTP) of srtp key used to secure this stream

Parameters
[in]stream_sessionsPointer to the stream session structure
[in]dirstream direction (send, recv or both)
[in]is_innerget the source of the inner encrytion if true
Returns
the srtp key source if they are consistent: both direction (send and receive) have the same source when dir is both MSSrtpKeySourceUnavailable otherwise