mediastreamer2 5.4.130
Audio conferencing API - Easily create conferences.

Audio conferencing API - Easily create conferences. More...

Collaboration diagram for Audio conferencing API - Easily create conferences.:

Data Structures

struct  _MSAudioConferenceParams

Typedefs

typedef void(* MSAudioConferenceNotifyActiveTalker) (struct _MSAudioConference *, struct _MSAudioEndpoint *ep)
typedef struct _MSAudioConferenceParams MSAudioConferenceParams
typedef struct _MSAudioConference MSAudioConference
typedef struct _MSAudioEndpoint MSAudioEndpoint

Enumerations

enum  MSStreamSecurityLevel {
  MSStreamSecurityLevelNone ,
  MSStreamSecurityLevelPointToPoint ,
  MSStreamSecurityLevelEndToEnd
}
enum  MSConferenceMode {
  MSConferenceModeMixer ,
  MSConferenceModeRouterPayload ,
  MSConferenceModeRouterFullPacket
}

Functions

MSAudioConference * ms_audio_conference_new (const MSAudioConferenceParams *params, MSFactory *factory)
const MSAudioConferenceParams * ms_audio_conference_get_params (MSAudioConference *obj)
void ms_audio_conference_add_member (MSAudioConference *obj, MSAudioEndpoint *ep)
void ms_audio_conference_remove_member (MSAudioConference *obj, MSAudioEndpoint *ep)
void ms_audio_conference_process_events (MSAudioConference *obj)
void ms_audio_conference_mute_member (MSAudioConference *obj, MSAudioEndpoint *ep, bool_t muted)
int ms_audio_conference_get_size (MSAudioConference *obj)
int ms_audio_conference_get_participant_volume (MSAudioConference *obj, uint32_t ssrc)
void ms_audio_conference_destroy (MSAudioConference *obj)
MSAudioEndpoint * ms_audio_endpoint_get_from_stream (AudioStream *st, bool_t is_remote, MSConferenceMode conf_mode)
void ms_audio_endpoint_set_user_data (MSAudioEndpoint *ep, void *user_data)
void * ms_audio_endpoint_get_user_data (const MSAudioEndpoint *ep)
void ms_audio_endpoint_release_from_stream (MSAudioEndpoint *obj)
MSAudioEndpoint * ms_audio_endpoint_new_recorder (MSFactory *factory, const char *path)
int ms_audio_recorder_endpoint_start (MSAudioEndpoint *ep)
int ms_audio_recorder_endpoint_stop (MSAudioEndpoint *ep)
void ms_audio_endpoint_destroy (MSAudioEndpoint *ep)
MSAudioEndpoint * ms_audio_endpoint_new_player (MSFactory *factory, const char *path)
void ms_audio_player_endpoint_set_eof_cb (MSAudioEndpoint *ep, MSFilterNotifyFunc cb, void *user_data)
int ms_audio_player_endpoint_start (MSAudioEndpoint *ep)
int ms_audio_player_endpoint_stop (MSAudioEndpoint *ep)
int ms_audio_player_endpoint_pause (MSAudioEndpoint *ep)
int ms_audio_player_endpoint_seek (MSAudioEndpoint *ep, int time_ms)
MSPlayerState ms_audio_player_endpoint_get_state (const MSAudioEndpoint *ep)

Detailed Description

Audio conferencing API - Easily create conferences.

Typedef Documentation

◆ MSAudioConference

typedef struct _MSAudioConference MSAudioConference

The MSAudioConference is the object representing an audio conference.

First, the conference has to be created with ms_audio_conference_new(), with parameters supplied. Then, participants to the conference can be added with ms_audio_conference_add_member(). The MSAudioConference takes in charge the mixing and dispatching of the audio to the participants. If participants (MSAudioEndpoint) are using sampling rate different from the conference, then sample rate converters are automatically added and configured. Participants can be removed from the conference with ms_audio_conference_remove_member(). The conference processing is performed in a new thread run by a MSTicker object, which is owned by the conference. When all participants are removed, the MSAudioConference object can then be safely destroyed with ms_audio_conference_destroy().

◆ MSAudioConferenceParams

Typedef to structure that holds conference parameters

◆ MSAudioEndpoint

typedef struct _MSAudioEndpoint MSAudioEndpoint

The MSAudioEndpoint represents a participant in the conference. It can be constructed from an existing AudioStream object with ms_audio_endpoint_get_from_stream().

Enumeration Type Documentation

◆ MSConferenceMode

The MSConferenceMode represents the different modes a conference can have.

MSConferenceModeMixer: The conference will decode all streams, mix what we need, and re-encode the result to send.

MSConferenceModeRouterPayload: The conference will route the streams' extracted payload without decoding and re-encoding. All audio is sent to everyone (except ourselves).

MSConferenceModeRouterFullPacket: The conference will route the streams without any modification, decoding and re-encoding. This mode will only send the relevant streams.

Be careful, the MSConferenceModeRouterPayload is meant to work (for now) for ONLY 2 participants in audio conferences. It can route more but it is not yet implemented client-side.

◆ MSStreamSecurityLevel

The MSStreamSecurityLevel represents the security level of the streams in a mixer

Function Documentation

◆ ms_audio_conference_add_member()

void ms_audio_conference_add_member ( MSAudioConference * obj,
MSAudioEndpoint * ep )

Adds a participant to the conference.

Parameters
objthe conference
epthe participant, represented as a MSAudioEndpoint object

◆ ms_audio_conference_destroy()

void ms_audio_conference_destroy ( MSAudioConference * obj)

Destroys a conference.

Parameters
objthe conference All participants must have been removed before destroying the conference.

◆ ms_audio_conference_get_params()

const MSAudioConferenceParams * ms_audio_conference_get_params ( MSAudioConference * obj)

Gets conference's current parameters.

Parameters
objthe conference.
Returns
a read-only pointer to the conference parameters.

◆ ms_audio_conference_get_participant_volume()

int ms_audio_conference_get_participant_volume ( MSAudioConference * obj,
uint32_t ssrc )

Returns the volume of a participant specified by it's SSRC.

Parameters
objthe conference
ssrcthe participant's ssrc
Returns
the volume of the participant in dbm0.

◆ ms_audio_conference_get_size()

int ms_audio_conference_get_size ( MSAudioConference * obj)

Returns the size (ie the number of participants) of a conference.

Parameters
objthe conference

◆ ms_audio_conference_mute_member()

void ms_audio_conference_mute_member ( MSAudioConference * obj,
MSAudioEndpoint * ep,
bool_t muted )

Mutes or unmutes a participant.

Parameters
objthe conference
epthe participant, represented as a MSAudioEndpoint object
mutedtrue to mute the participant, false to unmute.

By default all participants are unmuted.

◆ ms_audio_conference_new()

MSAudioConference * ms_audio_conference_new ( const MSAudioConferenceParams * params,
MSFactory * factory )

Creates a conference.

Parameters
paramsa MSAudioConferenceParams structure, containing conference parameters.
factorya MSFactory structure, containing filters parameters
Returns
a MSAudioConference object.

◆ ms_audio_conference_process_events()

void ms_audio_conference_process_events ( MSAudioConference * obj)

Process events of the audio conference. Calling this method periodically (for example every 50 ms), is necessary to receive the active talker notifications to the callback set in the MSAudioConferenceParams.

Parameters
objthe conference

◆ ms_audio_conference_remove_member()

void ms_audio_conference_remove_member ( MSAudioConference * obj,
MSAudioEndpoint * ep )

Removes a participant from the conference.

Parameters
objthe conference
epthe participant, represented as a MSAudioEndpoint object

◆ ms_audio_endpoint_destroy()

void ms_audio_endpoint_destroy ( MSAudioEndpoint * ep)

Destroy an audio endpoint.

Note
Endpoints created by ms_audio_endpoint_get_from_stream() must be released by ms_audio_endpoint_release_from_stream().

◆ ms_audio_endpoint_get_from_stream()

MSAudioEndpoint * ms_audio_endpoint_get_from_stream ( AudioStream * st,
bool_t is_remote,
MSConferenceMode conf_mode )

Creates an MSAudioEndpoint from an existing AudioStream.

In order to create graphs for audio processing of each participant, the AudioStream object is used, because this object already handles all the processing for volume control, encoding, decoding, etc...

The construction of the participants depends whether it is a remote participant, that is somebody in the network sending and receiving audio through RTP, or a local participant, that is somebody using the local soundcard to capture and play audio.

To create a remote participant, first create and start an AudioStream for the participant with audio_stream_new() and audio_stream_start_with_files(), given NULL arguments as input and output files. This participant does not interact with soundcards, this is why we suggest to use audio_stream_start_full() to avoid holding any reference to the sound system. Then, create a MSAudioEndpoint representing this participant by calling ms_audio_endpoint_get_from_stream() with is_remote=TRUE.

To create a local participant, first create and start an AudioStream with audio_stream_new() and audio_stream_start_full(), with real soundcard arguments. Arguments controlling RTP should be filled with placeholders value and will not be used for conferencing. Then, create a MSAudioEndpoint representing this local participant by calling ms_audio_endpoint_get_from_stream() with the audiostream and is_remote=FALSE.
For example:

 AudioStream *st=audio_stream_new(65000,65001,FALSE);
 audio_stream_start_full(st, conf->local_dummy_profile,
                                "127.0.0.1",
                                65000,
                                "127.0.0.1",
                                65001,
                                0,
                                40,
                                NULL,
                                NULL,
                                playcard,
                                captcard,
                                needs_echocancellation,
                                );
 MSAudioEndpoint *local_endpoint=ms_audio_endpoint_get_from_stream(st,FALSE);
 

◆ ms_audio_endpoint_get_user_data()

void * ms_audio_endpoint_get_user_data ( const MSAudioEndpoint * ep)

Get the user pointer associated to the endpoint.

Parameters
epthe endpoint
Returns
the user data

◆ ms_audio_endpoint_new_player()

MSAudioEndpoint * ms_audio_endpoint_new_player ( MSFactory * factory,
const char * path )

Creates an audio endpoint (or virtual participant) to play a wav file in the conference.

Parameters
factoryThe factory used by the linphone core.
pathThe path to the wav file to play in the conference.

◆ ms_audio_endpoint_new_recorder()

MSAudioEndpoint * ms_audio_endpoint_new_recorder ( MSFactory * factory,
const char * path )

Creates an audio endpoint (or virtual participant) to record the conference into a wav file.

Parameters
factoryThe factory used by the linphone core.
pathpath for the wav file where to record samples.

◆ ms_audio_endpoint_release_from_stream()

void ms_audio_endpoint_release_from_stream ( MSAudioEndpoint * obj)

Destroys a MSAudioEndpoint that was created from an AudioStream with ms_audio_endpoint_get_from_stream(). The AudioStream can then be destroyed if needed.

◆ ms_audio_endpoint_set_user_data()

void ms_audio_endpoint_set_user_data ( MSAudioEndpoint * ep,
void * user_data )

Associate a user pointer to the endpoint.

Parameters
epthe endpoint
user_datathe user data

◆ ms_audio_player_endpoint_get_state()

MSPlayerState ms_audio_player_endpoint_get_state ( const MSAudioEndpoint * ep)

Get the state of the audio player.

Parameters
epThe audio endpoint.
Returns
The state of the audio player.

◆ ms_audio_player_endpoint_pause()

int ms_audio_player_endpoint_pause ( MSAudioEndpoint * ep)

Pause audio file playing. The endpoint must have been created by ms_audio_endpoint_new_player() and the playing must have been started by ms_audio_player_endpoint_start().

Parameters
epThe audio endpoint.
Returns
0 if successful, -1 if the audio file could not be paused.

◆ ms_audio_player_endpoint_seek()

int ms_audio_player_endpoint_seek ( MSAudioEndpoint * ep,
int time_ms )

Seek in the audio file.

Parameters
epThe audio endpoint.
time_msThe time to which to seek to (in ms).
Returns
0 if successful, -1 otherwise.

◆ ms_audio_player_endpoint_set_eof_cb()

void ms_audio_player_endpoint_set_eof_cb ( MSAudioEndpoint * ep,
MSFilterNotifyFunc cb,
void * user_data )

Sets a callback to be notified when an audio file played with an audio endpoint has finished playing.

Parameters
epThe audio endpoint.
cbThe callback to set
user_dataA user data to pass to the callback.

◆ ms_audio_player_endpoint_start()

int ms_audio_player_endpoint_start ( MSAudioEndpoint * ep)

Start audio file playing. The endpoint must have been created by ms_audio_endpoint_new_player().

Parameters
epThe audio endpoint.
Returns
0 if successful, -1 if the path is invalid.

◆ ms_audio_player_endpoint_stop()

int ms_audio_player_endpoint_stop ( MSAudioEndpoint * ep)

Stop audio file playing. The endpoint must have been created by ms_audio_endpoint_new_player().

Parameters
epThe audio endpoint.
Returns
0 if successful, -1 if the audio file playing wasn't started.

◆ ms_audio_recorder_endpoint_start()

int ms_audio_recorder_endpoint_start ( MSAudioEndpoint * ep)

Start audio recording. The endpoint must have been created by ms_audio_endpoint_new_recorder().

Parameters
epthe endpoint
Returns
0 if successful, -1 if the path is invalid.

◆ ms_audio_recorder_endpoint_stop()

int ms_audio_recorder_endpoint_stop ( MSAudioEndpoint * ep)

Stop audio recording. The endpoint must have been created by ms_audio_endpoint_new_recorder().

Parameters
epthe endpoint
Returns
0 if successful, -1 if the record wasn't started.