mediastream.h 45 KB
Newer Older
aymeric's avatar
aymeric committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


#ifndef MEDIASTREAM_H
#define MEDIASTREAM_H

24 25 26
#include <ortp/ortp.h>
#include <ortp/event.h>

Simon Morlat's avatar
Simon Morlat committed
27 28 29 30 31
#include <mediastreamer2/msfilter.h>
#include <mediastreamer2/msticker.h>
#include <mediastreamer2/mssndcard.h>
#include <mediastreamer2/mswebcam.h>
#include <mediastreamer2/msvideo.h>
32 33
#include <mediastreamer2/bitratecontrol.h>
#include <mediastreamer2/qualityindicator.h>
34
#include <mediastreamer2/ice.h>
35
#include <mediastreamer2/zrtp.h>
johan's avatar
johan committed
36
#include <mediastreamer2/dtls_srtp.h>
johan's avatar
johan committed
37
#include <mediastreamer2/ms_srtp.h>
aymeric's avatar
aymeric committed
38

Ghislain MARY's avatar
Ghislain MARY committed
39

Simon Morlat's avatar
Simon Morlat committed
40 41 42
#define PAYLOAD_TYPE_FLAG_CAN_RECV	PAYLOAD_TYPE_USER_FLAG_1
#define PAYLOAD_TYPE_FLAG_CAN_SEND	PAYLOAD_TYPE_USER_FLAG_2

Ghislain MARY's avatar
Ghislain MARY committed
43 44 45 46 47

#ifdef __cplusplus
extern "C" {
#endif

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
/**
 * @addtogroup ring_api
 * @{
**/

struct _RingStream
{
	MSTicker *ticker;
	MSFilter *source;
	MSFilter *gendtmf;
	MSFilter *write_resampler;
	MSFilter *sndwrite;
};

typedef struct _RingStream RingStream;

MS2_PUBLIC RingStream *ring_start (const char * file, int interval, MSSndCard *sndcard);
MS2_PUBLIC RingStream *ring_start_with_cb(const char * file, int interval, MSSndCard *sndcard, MSFilterNotifyFunc func, void * user_data);
MS2_PUBLIC void ring_stop (RingStream * stream);

/**
 * @}
**/
71 72 73
/**
 * The MediaStream is an object describing a stream (one of AudioStream or VideoStream).
**/
jehan's avatar
jehan committed
74 75 76 77 78
typedef struct _MediaStream MediaStream;

/*
 * internal cb to process rtcp stream
 * */
79
typedef void (*media_stream_process_rtcp_callback_t)(MediaStream *stream, mblk_t *m);
jehan's avatar
jehan committed
80

81 82
struct _MSMediaStreamSessions{
	RtpSession *rtp_session;
83
	MSSrtpCtx* srtp_context;
84
	MSZrtpContext *zrtp_context;
johan's avatar
johan committed
85
	MSDtlsSrtpContext *dtls_context;
86 87 88
	MSTicker *ticker;
};

Simon Morlat's avatar
Simon Morlat committed
89
#ifndef MS_MEDIA_STREAM_SESSIONS_DEFINED
90
typedef struct _MSMediaStreamSessions MSMediaStreamSessions;
Simon Morlat's avatar
Simon Morlat committed
91 92
#define MS_MEDIA_STREAM_SESSIONS_DEFINED 1
#endif
jehan's avatar
jehan committed
93

94 95 96 97 98
MS2_PUBLIC void ms_media_stream_sessions_uninit(MSMediaStreamSessions *sessions);

typedef enum _MSStreamState{
	MSStreamInitialized,
	MSStreamPreparing,
99 100
	MSStreamStarted,
	MSStreamStopped
101 102
}MSStreamState;

Simon Morlat's avatar
Simon Morlat committed
103

104 105 106 107 108 109
typedef enum MediaStreamDir{
	MediaStreamSendRecv,
	MediaStreamSendOnly,
	MediaStreamRecvOnly
}MediaStreamDir;

110 111 112
/**
 * Base struct for both AudioStream and VideoStream structure.
**/
Ghislain MARY's avatar
Ghislain MARY committed
113
struct _MediaStream {
Simon Morlat's avatar
Simon Morlat committed
114
	MSFormatType type;
115 116
	MSStreamState state;
	MSMediaStreamSessions sessions;
Ghislain MARY's avatar
Ghislain MARY committed
117 118 119 120 121 122 123
	OrtpEvQueue *evq;
	MSFilter *rtprecv;
	MSFilter *rtpsend;
	MSFilter *encoder;
	MSFilter *decoder;
	MSFilter *voidsink;
	MSBitrateController *rc;
124
	MSQualityIndicator *qi;
Ghislain MARY's avatar
Ghislain MARY committed
125
	IceCheckList *ice_check_list;
126 127
	time_t start_time;
	time_t last_iterate_time;
128 129
	uint64_t last_packet_count;
	time_t last_packet_time;
130
	MSQosAnalyzerAlgorithm rc_algorithm;
131
	PayloadType *current_pt;/*doesn't need to be freed*/
132
	bool_t rc_enable;
133
	bool_t is_beginning;
134
	bool_t owns_sessions;
135
	bool_t pad;
jehan's avatar
jehan committed
136
	/**
137
	 * defines encoder target network bit rate, uses #media_stream_set_target_network_bitrate() setter.
jehan's avatar
jehan committed
138 139
	 * */
	int target_bitrate;
140
	media_stream_process_rtcp_callback_t process_rtcp;
141
	OrtpEvDispatcher *evd;
Ghislain MARY's avatar
Ghislain MARY committed
142 143
};

144 145
MS2_PUBLIC void media_stream_init(MediaStream *stream);

jehan's avatar
jehan committed
146 147 148 149 150

/**
 * @addtogroup audio_stream_api
 * @{
**/
Ghislain MARY's avatar
Ghislain MARY committed
151

152 153
MS2_PUBLIC bool_t media_stream_started(MediaStream *stream);

154 155
MS2_PUBLIC int media_stream_join_multicast_group(MediaStream *stream, const char *ip);

johan's avatar
johan committed
156 157
MS2_PUBLIC bool_t media_stream_dtls_supported(void);

158 159 160
/* enable DTLS on the media stream */
MS2_PUBLIC void media_stream_enable_dtls(MediaStream *stream, MSDtlsSrtpParams *params);

161 162 163 164 165 166 167 168
MS2_PUBLIC void media_stream_set_rtcp_information(MediaStream *stream, const char *cname, const char *tool);

MS2_PUBLIC void media_stream_get_local_rtp_stats(MediaStream *stream, rtp_stats_t *stats);

MS2_PUBLIC int media_stream_set_dscp(MediaStream *stream, int dscp);

MS2_PUBLIC void media_stream_enable_adaptive_bitrate_control(MediaStream *stream, bool_t enabled);

169 170
MS2_PUBLIC void media_stream_set_adaptive_bitrate_algorithm(MediaStream *stream, MSQosAnalyzerAlgorithm algorithm);

171 172
MS2_PUBLIC void media_stream_enable_adaptive_jittcomp(MediaStream *stream, bool_t enabled);

173 174 175
/*
 * deprecated, use media_stream_set_srtp_recv_key and media_stream_set_srtp_send_key.
**/
jehan's avatar
jehan committed
176 177 178
MS2_PUBLIC bool_t media_stream_enable_srtp(MediaStream* stream, MSCryptoSuite suite, const char* snd_key, const char* rcv_key);

/**
179
 * @param[in] stream MediaStream object
jehan's avatar
jehan committed
180 181
 * @return true if stream is encrypted
 * */
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
MS2_PUBLIC bool_t media_stream_secured(const MediaStream *stream);
#define media_stream_is_secured media_stream_secured

/**
 * Tells whether AVPF is enabled or not.
 * @param[in] stream #MediaStream object.
 * @return True if AVPF is enabled, false otherwise.
 */
MS2_PUBLIC bool_t media_stream_avpf_enabled(const MediaStream *stream);

/**
 * Gets the AVPF Regular RTCP report interval.
 * @param[in] stream #MediaStream object.
 * @return The AVPF Regular RTCP report interval in seconds.
 */
197
MS2_PUBLIC uint16_t media_stream_get_avpf_rr_interval(const MediaStream *stream);
198

199 200 201 202 203 204
/**
 * Gets the RTP session of the media stream.
 * @param[in] stream #MediaStream object.
 * @return The RTP session of the media stream.
 */
MS2_PUBLIC RtpSession * media_stream_get_rtp_session(const MediaStream *stream);
205

206
MS2_PUBLIC const MSQualityIndicator *media_stream_get_quality_indicator(MediaStream *stream);
jehan's avatar
jehan committed
207 208 209
/* *
 * returns a realtime indicator of the stream quality between 0 and 5
 * */
210
MS2_PUBLIC float media_stream_get_quality_rating(MediaStream *stream);
211

212 213
MS2_PUBLIC float media_stream_get_average_quality_rating(MediaStream *stream);

214 215 216 217
MS2_PUBLIC float media_stream_get_lq_quality_rating(MediaStream *stream);

MS2_PUBLIC float media_stream_get_average_lq_quality_rating(MediaStream *stream);

218
/**
jehan's avatar
jehan committed
219 220 221 222 223 224 225 226 227 228 229 230
 * <br>For multirate codecs like OPUS, encoder output target bitrate must be set.
 * <br>Encoder will compute output codec bitrate from this value.
 * <br> default value is the value corresponding the rtp PayloadType
 * @param stream stream to apply parameter on
 * @param target_bitrate in bit per seconds
 * @return 0 if succeed
 * */
MS2_PUBLIC int media_stream_set_target_network_bitrate(MediaStream *stream,int target_bitrate);

/**
 * get the stream target bitrate.
 * @param stream stream to apply parameter on
231
 * @return target_bitrate in bit per seconds
jehan's avatar
jehan committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
 * */
MS2_PUBLIC int media_stream_get_target_network_bitrate(const MediaStream *stream);

/**
 * get current stream  upload bitrate. Value is updated every seconds
 * @param stream
 * @return bitrate in bit per seconds
 * */
MS2_PUBLIC float media_stream_get_up_bw(const MediaStream *stream);

/**
 * get current stream download bitrate. Value is updated every seconds
 * @param stream
 * @return bitrate in bit per seconds
 * */
MS2_PUBLIC float media_stream_get_down_bw(const MediaStream *stream);

249 250 251 252 253 254 255 256 257 258 259 260 261 262
/**
 * get current stream rtcp upload bitrate. Value is updated every seconds
 * @param stream
 * @return bitrate in bit per seconds
 * */
MS2_PUBLIC float media_stream_get_rtcp_up_bw(const MediaStream *stream);

/**
 * get current stream rtcp download bitrate. Value is updated every seconds
 * @param stream
 * @return bitrate in bit per seconds
 * */
MS2_PUBLIC float media_stream_get_rtcp_down_bw(const MediaStream *stream);

263 264 265 266 267 268
/**
 * 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.
**/
MS2_PUBLIC void media_stream_reclaim_sessions(MediaStream *stream, MSMediaStreamSessions *sessions);

jehan's avatar
jehan committed
269

270
MS2_PUBLIC void media_stream_iterate(MediaStream * stream);
jehan's avatar
jehan committed
271

272 273 274 275 276
/**
 * Returns TRUE if stream was still actively receiving packets (RTP or RTCP) in the last period specified in timeout_seconds.
**/
MS2_PUBLIC bool_t media_stream_alive(MediaStream *stream, int timeout_seconds);

jehan's avatar
jehan committed
277
/**
jehan's avatar
jehan committed
278
 * @return current streams state
jehan's avatar
jehan committed
279 280
 * */
MS2_PUBLIC MSStreamState media_stream_get_state(const MediaStream *stream);
281

282 283
MS2_PUBLIC OrtpEvDispatcher* media_stream_get_event_dispatcher(const MediaStream *stream);

284 285 286
typedef enum EchoLimiterType{
	ELInactive,
	ELControlMic,
287
	ELControlFull
288 289
} EchoLimiterType;

290 291 292 293 294 295

typedef enum EqualizerLocation {
	MSEqualizerHP = 0,
	MSEqualizerMic
} EqualizerLocation;

jehan's avatar
jehan committed
296

297 298 299 300 301 302 303 304 305 306 307
typedef enum MSResourceType{
	MSResourceInvalid,
	MSResourceDefault,
	MSResourceFile,
	MSResourceRtp,
	MSResourceCamera,
	MSResourceSoundcard
}MSResourceType;

MS2_PUBLIC const char *ms_resource_type_to_string(MSResourceType type);

308
/**
309 310 311 312 313
 * 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.
 * @warning due to implementation, if RTP is to be used for input and output, the same RtpSession must be passed for both sides.
314
 */
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
typedef struct _MSMediaResource{
	MSResourceType type;
	union{
		void *resource_arg;
		const char *file;
		RtpSession *session;
		MSWebCam *camera;
		MSSndCard *soundcard;
	};
}MSMediaResource;


MS2_PUBLIC bool_t ms_media_resource_is_consistent(const MSMediaResource *r);
#define ms_media_resource_get_file(r)		(((r)->type == MSResourceFile) ? (r)->file : NULL)
#define ms_media_resource_get_rtp_session(r)	(((r)->type == MSResourceRtp) ? (r)->session : NULL)
#define ms_media_resource_get_camera(r)		(((r)->type == MSResourceCamera) ? (r)->camera : NULL)
#define ms_media_resource_get_soundcard(r)	(((r)->type == MSResourceSoundcard) ? (r)->souncard : NULL)
/**
 * Structure describing the input/output of a MediaStream.
 * Input and output are described as MSMediaResource.
 */
typedef struct _MSMediaStreamIO {
	MSMediaResource input;
	MSMediaResource output;
} MSMediaStreamIO;
340

341 342 343
#define MS_MEDIA_STREAM_IO_INITIALIZER { {0}, {0} }

MS2_PUBLIC bool_t ms_media_stream_io_is_consistent(const MSMediaStreamIO *io);
jehan's avatar
jehan committed
344

aymeric's avatar
aymeric committed
345 346
struct _AudioStream
{
Ghislain MARY's avatar
Ghislain MARY committed
347
	MediaStream ms;
aymeric's avatar
aymeric committed
348 349 350
	MSFilter *soundread;
	MSFilter *soundwrite;
	MSFilter *dtmfgen;
351
	MSFilter *dtmfgen_rtp;
Yann Diorcet's avatar
Yann Diorcet committed
352
	MSFilter *plc;
aymeric's avatar
aymeric committed
353
	MSFilter *ec;/*echo canceler*/
354
	MSFilter *volsend,*volrecv; /*MSVolumes*/
355 356 357
	MSFilter *local_mixer;
	MSFilter *local_player;
	MSFilter *local_player_resampler;
358 359
	MSFilter *read_decoder; /* Used when the input is done via RTP */
	MSFilter *write_encoder; /* Used when the output is done via RTP */
360 361
	MSFilter *read_resampler;
	MSFilter *write_resampler;
smorlat's avatar
smorlat committed
362
	MSFilter *equalizer;
Simon Morlat's avatar
Simon Morlat committed
363
	MSFilter *dummy;
364 365 366
	MSFilter *recv_tee;
	MSFilter *recorder_mixer;
	MSFilter *recorder;
367
	MSFilter *outbound_mixer;
Simon Morlat's avatar
Simon Morlat committed
368 369 370 371 372 373
	struct {
		MSFilter *resampler;
		MSFilter *encoder;
		MSFilter *recorder;
		MSFilter *video_input;
	}av_recorder;
374 375 376 377 378 379 380 381 382
	struct _AVPlayer{
		MSFilter *player;
		MSFilter *resampler;
		MSFilter *decoder;
		MSFilter *video_output;
		int audiopin;
		int videopin;
		bool_t plumbed;
	}av_player;
383
	RtpSession *rtp_io_session; /**< The RTP session used for RTP input/output. */
384
	MSFilter *vaddtx;
385
	char *recorder_file;
386
	EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
387
	EqualizerLocation eq_loc;
Ghislain MARY's avatar
Ghislain MARY committed
388
	uint32_t features;
389 390
	int sample_rate;
	int nchannels;
391
	struct _VideoStream *videostream;/*the stream with which this audiostream is paired*/
smorlat's avatar
smorlat committed
392
	bool_t play_dtmfs;
393
	bool_t use_ec;
smorlat's avatar
smorlat committed
394
	bool_t use_gc;
395
	bool_t use_agc;
smorlat's avatar
smorlat committed
396
	bool_t eq_active;
397
	bool_t use_ng;/*noise gate*/
398
	bool_t is_ec_delay_set;
aymeric's avatar
aymeric committed
399 400
};

401 402 403
/**
 * The AudioStream holds all resources to create and run typical VoIP audiostream.
**/
aymeric's avatar
aymeric committed
404 405 406 407
typedef struct _AudioStream AudioStream;


/* start a thread that does sampling->encoding->rtp_sending|rtp_receiving->decoding->playing */
Simon Morlat's avatar
Simon Morlat committed
408
MS2_PUBLIC AudioStream *audio_stream_start (RtpProfile * prof, int locport, const char *remip,
aymeric's avatar
aymeric committed
409 410
				 int remport, int payload_type, int jitt_comp, bool_t echo_cancel);

Simon Morlat's avatar
Simon Morlat committed
411
MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile * prof, int locport, const char *remip4, int remport, int payload_type, int jitt_comp, MSSndCard *playcard, MSSndCard *captcard, bool_t echocancel);
aymeric's avatar
aymeric committed
412

Simon Morlat's avatar
Simon Morlat committed
413
MS2_PUBLIC int audio_stream_start_with_files (AudioStream * stream, RtpProfile * prof,
414 415 416
						const char *remip, int remport, int rem_rtcp_port,
						int pt, int jitt_comp,
						const char * infile,  const char * outfile);
aymeric's avatar
aymeric committed
417

418 419 420 421 422 423 424 425 426
/**
 * Start an audio stream according to the specified AudioStreamIO.
 *
 * @param[in] stream AudioStream object previously created with audio_stream_new().
 * @param[in] profile RtpProfile object holding the PayloadType that can be used during the audio session.
 * @param[in] rem_rtp_ip The remote IP address where to send the encoded audio to.
 * @param[in] rem_rtp_port The remote port where to send the encoded audio to.
 * @param[in] rem_rtcp_ip The remote IP address for RTCP.
 * @param[in] rem_rtcp_port The remote port for RTCP.
427 428
 * @param[in] payload_type The payload type number used to send the audio stream. A valid PayloadType must be available at this index in the profile.
 * @param[in] io A MSMediaStreamIO describing the local input/output of the audio stream.
429 430
 */
MS2_PUBLIC int audio_stream_start_from_io(AudioStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port,
431
	const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const MSMediaStreamIO *io);
432

433 434
/**
 * Starts an audio stream from/to local wav files or soundcards.
435
 *
436 437
 * 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.
438 439
 *
 *
440
 * @param stream an AudioStream previously created with audio_stream_new().
441
 * @param profile a RtpProfile containing all PayloadType possible during the audio session.
442 443 444
 * @param rem_rtp_ip remote IP address where to send the encoded audio.
 * @param rem_rtp_port remote IP port where to send the encoded audio.
 * @param rem_rtcp_ip remote IP address for RTCP.
445
 * @param rem_rtcp_port remote port for RTCP.
446
 * @param payload payload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile.
447 448 449 450 451
 * @param jitt_comp Nominal jitter buffer size in milliseconds.
 * @param infile path to wav file to play out (can be NULL)
 * @param outfile path to wav file to record into (can be NULL)
 * @param playcard The soundcard to be used for playback (can be NULL)
 * @param captcard The soundcard to be used for catpure. (can be NULL)
452
 * @param use_ec whether echo cancellation is to be performed.
453
 * @return 0 if sucessful, -1 otherwise.
454
**/
455 456
MS2_PUBLIC 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,
457 458
	MSSndCard *playcard, MSSndCard *captcard, bool_t use_ec);

459

Simon Morlat's avatar
Simon Morlat committed
460 461
MS2_PUBLIC void audio_stream_play(AudioStream *st, const char *name);
MS2_PUBLIC void audio_stream_record(AudioStream *st, const char *name);
aymeric's avatar
aymeric committed
462

463
static MS2_INLINE void audio_stream_set_rtcp_information(AudioStream *st, const char *cname, const char *tool) {
Ghislain MARY's avatar
Ghislain MARY committed
464 465
	media_stream_set_rtcp_information(&st->ms, cname, tool);
}
aymeric's avatar
aymeric committed
466

Simon Morlat's avatar
Simon Morlat committed
467
MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno);
smorlat's avatar
smorlat committed
468

469 470
/**
 * Creates an AudioStream object listening on a RTP port.
471 472
 * @param loc_rtp_port the local UDP port to listen for RTP packets.
 * @param loc_rtcp_port the local UDP port to listen for RTCP packets
473
 * @param ipv6 TRUE if ipv6 must be used.
474
 * @return a new AudioStream.
475
**/
476
MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
Simon Morlat's avatar
Simon Morlat committed
477

jehan's avatar
jehan committed
478 479 480 481 482 483 484 485 486 487
/**
 * Creates an AudioStream object listening on a RTP port for a dedicated address.
 * @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
 * @param loc_rtp_port the local UDP port to listen for RTP packets.
 * @param loc_rtcp_port the local UDP port to listen for RTCP packets
 * @return a new AudioStream.
**/
MS2_PUBLIC AudioStream *audio_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);


488 489
/**Creates an AudioStream object from initialized MSMediaStreamSessions.
 * @param sessions the MSMediaStreamSessions
490
 * @return a new AudioStream
491 492 493
**/
MS2_PUBLIC AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions);

494 495 496 497 498 499 500 501
#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)
502
#define AUDIO_STREAM_FEATURE_LOCAL_PLAYING	(1 << 8)
503
#define AUDIO_STREAM_FEATURE_REMOTE_PLAYING	(1 << 9)
504

Yann Diorcet's avatar
Yann Diorcet committed
505 506 507 508 509 510 511
#define AUDIO_STREAM_FEATURE_ALL	(\
					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 | \
512
					AUDIO_STREAM_FEATURE_DTMF_ECHO |\
513
					AUDIO_STREAM_FEATURE_MIXED_RECORDING |\
514 515
					AUDIO_STREAM_FEATURE_LOCAL_PLAYING | \
					AUDIO_STREAM_FEATURE_REMOTE_PLAYING \
Yann Diorcet's avatar
Yann Diorcet committed
516 517
					)

518

Yann Diorcet's avatar
Yann Diorcet committed
519 520
MS2_PUBLIC uint32_t audio_stream_get_features(AudioStream *st);
MS2_PUBLIC void audio_stream_set_features(AudioStream *st, uint32_t features);
521

Simon Morlat's avatar
Simon Morlat committed
522 523 524
MS2_PUBLIC void audio_stream_prepare_sound(AudioStream *st, MSSndCard *playcard, MSSndCard *captcard);
MS2_PUBLIC void audio_stream_unprepare_sound(AudioStream *st);
MS2_PUBLIC bool_t audio_stream_started(AudioStream *stream);
525 526
/**
 * Starts an audio stream from local soundcards.
527
 *
528 529
 * 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.
530
 *
531 532 533 534 535 536 537 538 539 540 541
 * @param stream an AudioStream previously created with audio_stream_new().
 * @param prof a RtpProfile containing all PayloadType possible during the audio session.
 * @param remip remote IP address where to send the encoded audio.
 * @param remport remote IP port where to send the encoded audio
 * @param rem_rtcp_port remote port for RTCP.
 * @param payload_type payload type index to use for the sending stream. This index must point to a valid PayloadType in the RtpProfile.
 * @param jitt_comp Nominal jitter buffer size in milliseconds.
 * @param playcard The soundcard to be used for playback
 * @param captcard The soundcard to be used for catpure.
 * @param echo_cancel whether echo cancellation is to be performed.
**/
Simon Morlat's avatar
Simon Morlat committed
542 543
MS2_PUBLIC 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);
MS2_PUBLIC void audio_stream_set_relay_session_id(AudioStream *stream, const char *relay_session_id);
aymeric's avatar
aymeric committed
544
/*returns true if we are still receiving some data from remote end in the last timeout seconds*/
Simon Morlat's avatar
Simon Morlat committed
545
MS2_PUBLIC bool_t audio_stream_alive(AudioStream * stream, int timeout);
aymeric's avatar
aymeric committed
546

547 548 549 550
/**
 * 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.
 */
551 552
MS2_PUBLIC void audio_stream_iterate(AudioStream *stream);

jehan's avatar
jehan committed
553 554 555
/**
 * enable echo-limiter dispositve: one MSVolume in input branch controls a MSVolume in the output branch
 * */
Simon Morlat's avatar
Simon Morlat committed
556
MS2_PUBLIC void audio_stream_enable_echo_limiter(AudioStream *stream, EchoLimiterType type);
557

jehan's avatar
jehan committed
558 559 560
/**
 * enable gain control, to be done before start()
 * */
Simon Morlat's avatar
Simon Morlat committed
561
MS2_PUBLIC void audio_stream_enable_gain_control(AudioStream *stream, bool_t val);
smorlat's avatar
smorlat committed
562

jehan's avatar
jehan committed
563 564 565
/**
 * enable automatic gain control, to be done before start()
 * */
Simon Morlat's avatar
Simon Morlat committed
566
MS2_PUBLIC void audio_stream_enable_automatic_gain_control(AudioStream *stream, bool_t val);
567

jehan's avatar
jehan committed
568 569 570
/**
 * to be done before start
 *  */
Simon Morlat's avatar
Simon Morlat committed
571
MS2_PUBLIC void audio_stream_set_echo_canceller_params(AudioStream *st, int tail_len_ms, int delay_ms, int framesize);
572

573 574 575 576 577

/**
 * to be done before start
 *  */
MS2_PUBLIC void audio_stream_enable_echo_canceller(AudioStream *st, bool_t enabled);
jehan's avatar
jehan committed
578 579 580
/**
 * enable adaptive rate control
 * */
581
static MS2_INLINE void audio_stream_enable_adaptive_bitrate_control(AudioStream *stream, bool_t enabled) {
Ghislain MARY's avatar
Ghislain MARY committed
582 583
	media_stream_enable_adaptive_bitrate_control(&stream->ms, enabled);
}
584

jehan's avatar
jehan committed
585 586 587
/**
 *  Enable adaptive jitter compensation
 *  */
588
static MS2_INLINE void audio_stream_enable_adaptive_jittcomp(AudioStream *stream, bool_t enabled) {
Ghislain MARY's avatar
Ghislain MARY committed
589 590
	media_stream_enable_adaptive_jittcomp(&stream->ms, enabled);
}
591

592
/**
593 594 595 596 597 598 599 600
 * 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.
 * 
 * @param stream The stream.
 * @param gain Gain to apply in dB.
601
 */
602 603
MS2_PUBLIC void audio_stream_set_mic_gain_db(AudioStream *stream, float gain_db);

604 605

/**
606 607
 * Like audio_stream_set_mic_gain_db() excepted that the gain is specified
 * in percentage.
608
 * 
609 610
 * @param stream The stream.
 * @param gain Gain to apply in percetage of the max supported gain.
611
 */
612
MS2_PUBLIC void audio_stream_set_mic_gain(AudioStream *stream, float gain);
613

jehan's avatar
jehan committed
614 615 616
/**
 *  enable/disable rtp stream
 *  */
Simon Morlat's avatar
Simon Morlat committed
617
MS2_PUBLIC void audio_stream_mute_rtp(AudioStream *stream, bool_t val);
Simon Morlat's avatar
Simon Morlat committed
618

619
/**
620
 * Set microphone volume gain.
621
 * If the sound backend supports it, the set volume gain will be synchronized
622 623 624
 * 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().
 * 
625 626 627
 * @param stream The audio stream.
 * @param gain Percentage of the max supported volume gain. Valid values are in [0.0 : 1.0].
 */
628
MS2_PUBLIC void audio_stream_set_sound_card_input_gain(AudioStream *stream, float gain);
629 630

/**
631
 * Get microphone volume gain.
632 633 634 635
 * @param stream The audio stream.
 * @return 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.
 */
636
MS2_PUBLIC float audio_stream_get_sound_card_input_gain(const AudioStream *stream);
637 638

/**
639
 * Set speaker volume gain.
640 641 642 643 644
 * If the sound backend supports it, the set volume gain will be synchronized
 * with the host system mixer.
 * @param stream The audio stream.
 * @param gain Percentage of the max supported volume gain. Valid values are in [0.0 : 1.0].
 */
645
MS2_PUBLIC void audio_stream_set_sound_card_output_gain(AudioStream *stream, float volume);
646 647

/**
648
 * Get speaker volume gain.
649 650 651 652
 * @param stream The audio stream.
 * @return 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.
 */
653
MS2_PUBLIC float audio_stream_get_sound_card_output_gain(const AudioStream *stream);
654

jehan's avatar
jehan committed
655 656 657
/**
 * enable noise gate, must be done before start()
 * */
Simon Morlat's avatar
Simon Morlat committed
658
MS2_PUBLIC void audio_stream_enable_noise_gate(AudioStream *stream, bool_t val);
659

jehan's avatar
jehan committed
660 661 662
/**
 * enable parametric equalizer in the stream that goes to the speaker
 * */
Simon Morlat's avatar
Simon Morlat committed
663
MS2_PUBLIC void audio_stream_enable_equalizer(AudioStream *stream, bool_t enabled);
smorlat's avatar
smorlat committed
664

Simon Morlat's avatar
Simon Morlat committed
665
MS2_PUBLIC void audio_stream_equalizer_set_gain(AudioStream *stream, int frequency, float gain, int freq_width);
smorlat's avatar
smorlat committed
666

jehan's avatar
jehan committed
667 668 669
/**
 *  stop the audio streaming thread and free everything
 *  */
Simon Morlat's avatar
Simon Morlat committed
670
MS2_PUBLIC void audio_stream_stop (AudioStream * stream);
aymeric's avatar
aymeric committed
671

jehan's avatar
jehan committed
672 673 674
/**
 *  send a dtmf
 *  */
Simon Morlat's avatar
Simon Morlat committed
675
MS2_PUBLIC int audio_stream_send_dtmf (AudioStream * stream, char dtmf);
aymeric's avatar
aymeric committed
676

677 678
MS2_PUBLIC MSFilter *audio_stream_get_local_player(AudioStream *stream);

679 680 681 682 683 684
MS2_PUBLIC int audio_stream_mixed_record_open(AudioStream *st, const char*filename);

MS2_PUBLIC int audio_stream_mixed_record_start(AudioStream *st);

MS2_PUBLIC int audio_stream_mixed_record_stop(AudioStream *st);

685 686 687 688 689 690
/**
 * 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.
**/
MS2_PUBLIC MSFilter * audio_stream_open_remote_play(AudioStream *stream, const char *filename);

691 692
MS2_PUBLIC void audio_stream_close_remote_play(AudioStream *stream);

Simon Morlat's avatar
Simon Morlat committed
693
MS2_PUBLIC void audio_stream_set_default_card(int cardindex);
aymeric's avatar
aymeric committed
694

Simon Morlat's avatar
Simon Morlat committed
695
/* retrieve RTP statistics*/
696
static MS2_INLINE void audio_stream_get_local_rtp_stats(AudioStream *stream, rtp_stats_t *stats) {
Ghislain MARY's avatar
Ghislain MARY committed
697 698
	media_stream_get_local_rtp_stats(&stream->ms, stats);
}
Simon Morlat's avatar
Simon Morlat committed
699

700
/* returns a realtime indicator of the stream quality between 0 and 5 */
701 702
MS2_PUBLIC float audio_stream_get_quality_rating(AudioStream *stream);

703 704
/* returns the quality rating as an average since the start of the streaming session.*/
MS2_PUBLIC float audio_stream_get_average_quality_rating(AudioStream *stream);
aymeric's avatar
aymeric committed
705

706 707 708 709 710 711
/* returns a realtime indicator of the listening quality of the stream between 0 and 5 */
MS2_PUBLIC float audio_stream_get_lq_quality_rating(AudioStream *stream);

/* returns the listening quality rating as an average since the start of the streaming session.*/
MS2_PUBLIC float audio_stream_get_average_lq_quality_rating(AudioStream *stream);

Guillaume Beraudo's avatar
Guillaume Beraudo committed
712
/* enable ZRTP on the audio stream */
713
MS2_PUBLIC void audio_stream_enable_zrtp(AudioStream *stream, MSZrtpParams *params);
jehan's avatar
jehan committed
714 715 716 717
/**
 * 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 #
 * */
bool_t  audio_stream_zrtp_enabled(const AudioStream *stream);
Guillaume Beraudo's avatar
Guillaume Beraudo committed
718

719
/* enable SRTP on the audio stream */
720
static MS2_INLINE bool_t audio_stream_enable_srtp(AudioStream* stream, MSCryptoSuite suite, const char* snd_key, const char* rcv_key) {
Ghislain MARY's avatar
Ghislain MARY committed
721 722
	return media_stream_enable_srtp(&stream->ms, suite, snd_key, rcv_key);
}
Guillaume Beraudo's avatar
Guillaume Beraudo committed
723

724
static MS2_INLINE int audio_stream_set_dscp(AudioStream *stream, int dscp) {
Ghislain MARY's avatar
Ghislain MARY committed
725 726
	return media_stream_set_dscp(&stream->ms, dscp);
}
Simon Morlat's avatar
Simon Morlat committed
727

728 729 730 731 732 733 734 735 736 737
/**
 * Gets the RTP session of an audio stream.
 * @param[in] stream #MediaStream object.
 * @return The RTP session of the audio stream.
 */
static MS2_INLINE RtpSession * audio_stream_get_rtp_session(const AudioStream *stream) {
	return media_stream_get_rtp_session(&stream->ms);
}


Simon Morlat's avatar
Simon Morlat committed
738

739 740 741 742 743 744 745 746 747
/**
 * @}
**/


/**
 * @addtogroup video_stream_api
 * @{
**/
aymeric's avatar
aymeric committed
748

749
typedef void (*VideoStreamRenderCallback)(void *user_pointer, const MSPicture *local_view, const MSPicture *remote_view);
750 751 752
typedef void (*VideoStreamEventCallback)(void *user_pointer, const MSFilter *f, const unsigned int event_id, const void *args);


753

754

aymeric's avatar
aymeric committed
755 756
struct _VideoStream
{
Ghislain MARY's avatar
Ghislain MARY committed
757
	MediaStream ms;
758
	MSFilter *void_source;
aymeric's avatar
aymeric committed
759 760
	MSFilter *source;
	MSFilter *pixconv;
761
	MSFilter *sizeconv;
aymeric's avatar
aymeric committed
762 763
	MSFilter *tee;
	MSFilter *output;
764 765
	MSFilter *tee2;
	MSFilter *jpegwriter;
766
	MSFilter *output2;
Simon Morlat's avatar
Simon Morlat committed
767
	MSFilter *tee3;
768
	MSFilter *recorder_output; /*can be an ItcSink to send video to the audiostream's multimedia recorder, or directly a MkvRecorder */
769
	MSFilter *local_jpegwriter;
smorlat's avatar
smorlat committed
770
	MSVideoSize sent_vsize;
771
	MSVideoSize preview_vsize;
772 773
	float fps; /*the target fps explicitely set by application, overrides internally selected fps*/
	float configured_fps; /*the fps that was configured to the encoder. It might be different from the one really obtained from camera.*/
smorlat's avatar
smorlat committed
774
	int corner; /*for selfview*/
775 776
	VideoStreamRenderCallback rendercb;
	void *render_pointer;
777 778
	VideoStreamEventCallback eventcb;
	void *event_pointer;
779
	char *display_name;
780 781
	void *window_id;
	void *preview_window_id;
782
	MediaStreamDir dir;
783
	MSWebCam *cam;
784
	RtpSession *rtp_io_session; /**< The RTP session used for RTP input/output. */
785
	char *preset;
786
	int device_orientation; /* warning: meaning of this variable depends on the platform (Android, iOS, ...) */
Simon Morlat's avatar
Simon Morlat committed
787
	uint64_t last_reported_decoding_error_time;
788
	uint64_t last_fps_check;
Ghislain MARY's avatar
Ghislain MARY committed
789
	bool_t use_preview_window;
790
	bool_t freeze_on_error;
Ghislain MARY's avatar
Ghislain MARY committed
791
	bool_t display_filter_auto_rotate_enabled;
792 793
	bool_t source_performs_encoding;
	bool_t output_performs_decoding;
794
	bool_t player_active;
795
	bool_t staticimage_webcam_fps_optimization; /* if TRUE, the StaticImage webcam will ignore the fps target in order to save CPU time. Default is TRUE */
aymeric's avatar
aymeric committed
796 797 798
};

typedef struct _VideoStream VideoStream;
smorlat's avatar
smorlat committed
799

800

801
MS2_PUBLIC VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6);
jehan's avatar
jehan committed
802 803 804 805 806 807 808 809 810
/**
 * Creates an VideoStream object listening on a RTP port for a dedicated address.
 * @param loc_ip the local ip to listen for RTP packets. Can be ::, O.O.O.O or any ip4/6 addresses
 * @param [in] loc_rtp_port the local UDP port to listen for RTP packets.
 * @param [in] loc_rtcp_port the local UDP port to listen for RTCP packets
 * @return a new AudioStream.
**/
MS2_PUBLIC VideoStream *video_stream_new2(const char* ip, int loc_rtp_port, int loc_rtcp_port);

811
MS2_PUBLIC VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *sessions);
812
MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, MediaStreamDir dir);
813
static MS2_INLINE void video_stream_enable_adaptive_bitrate_control(VideoStream *stream, bool_t enabled) {
Ghislain MARY's avatar
Ghislain MARY committed
814 815
	media_stream_enable_adaptive_bitrate_control(&stream->ms, enabled);
}
816
static MS2_INLINE void video_stream_enable_adaptive_jittcomp(VideoStream *stream, bool_t enabled) {
Ghislain MARY's avatar
Ghislain MARY committed
817 818
	media_stream_enable_adaptive_jittcomp(&stream->ms, enabled);
}
Simon Morlat's avatar
Simon Morlat committed
819 820 821
MS2_PUBLIC void video_stream_set_render_callback(VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer);
MS2_PUBLIC void video_stream_set_event_callback(VideoStream *s, VideoStreamEventCallback cb, void *user_pointer);
MS2_PUBLIC void video_stream_set_display_filter_name(VideoStream *s, const char *fname);
822 823
MS2_PUBLIC int video_stream_start_with_source(VideoStream *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, MSWebCam* cam, MSFilter* source);
824 825 826 827
MS2_PUBLIC int video_stream_start(VideoStream * 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, MSWebCam *device);
MS2_PUBLIC int video_stream_start_with_files(VideoStream *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 char *play_file, const char *record_file);
828 829 830 831 832 833 834 835 836 837

/**
 * Start a video stream according to the specified VideoStreamIO.
 *
 * @param[in] stream VideoStream object previously created with video_stream_new().
 * @param[in] profile RtpProfile object holding the PayloadType that can be used during the video session.
 * @param[in] rem_rtp_ip The remote IP address where to send the encoded video to.
 * @param[in] rem_rtp_port The remote port where to send the encoded video to.
 * @param[in] rem_rtcp_ip The remote IP address for RTCP.
 * @param[in] rem_rtcp_port The remote port for RTCP.
838
 * @param[in] payload_type The payload type number used to send the video stream. A valid PayloadType must be available at this index in the profile.
839 840 841
 * @param[in] io A VideoStreamIO describing the input/output of the video stream.
 */
MS2_PUBLIC int video_stream_start_from_io(VideoStream *stream, RtpProfile *profile, const char *rem_rtp_ip, int rem_rtp_port,
842
	const char *rem_rtcp_ip, int rem_rtcp_port, int payload_type, const MSMediaStreamIO *io);
843

844 845
MS2_PUBLIC void video_stream_prepare_video(VideoStream *stream);
MS2_PUBLIC void video_stream_unprepare_video(VideoStream *stream);
846 847


Simon Morlat's avatar
Simon Morlat committed
848
MS2_PUBLIC void video_stream_set_relay_session_id(VideoStream *stream, const char *relay_session_id);
849
static MS2_INLINE void video_stream_set_rtcp_information(VideoStream *st, const char *cname, const char *tool) {
Ghislain MARY's avatar
Ghislain MARY committed
850 851
	media_stream_set_rtcp_information(&st->ms, cname, tool);
}
jehan's avatar
jehan committed
852 853 854 855
/*
 * returns current MSWebCam for a given stream
 * */
MS2_PUBLIC const MSWebCam * video_stream_get_camera(const VideoStream *stream);
856 857 858 859 860 861 862 863

/**
 * Returns the current video stream source filter. Be careful, this source will be
 * destroyed if the stream is stopped.
 * @return current stream source
 */
MS2_PUBLIC MSFilter* video_stream_get_source_filter(const VideoStream* stream);

Simon Morlat's avatar
Simon Morlat committed
864
MS2_PUBLIC void video_stream_change_camera(VideoStream *stream, MSWebCam *cam);
865 866 867 868 869

/**
 * @brief This functions changes the source filter for the passed video stream.
 * @details This is quite the same function as \ref video_stream_change_camera, but this one
 * allows you to pass the source filter that is created for the camera and reuse it. This gives you the
870
 * ability to switch rapidly between two streams, whereas re-creating them each time would be
871 872
 * costly (especially with webcams).
 *
873 874
 * @note Since the \ref video_stream_stop() will automatically destroy the source, it is
 *		advised that you use \ref video_stream_stop_keep_source() instead, so that you
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902
 *		can manually destroy the source filters after the stream is stopped.
 *
 * Example usage:
 *
 *		video_stream_start(stream, profile, [...], noWebcamDevice);
 *		// We manage the sources for the stream ourselves:
 *		MSFilter* noWebCamFilter = video_stream_get_source_filter(stream);
 *		MSFilter* frontCamFilter = ms_web_cam_create_reader(frontCamDevice);
 *
 * 		sleep(1);
 * 		video_stream_change_source_filter(stream, frontCamDevice, frontCamFilter, TRUE); // will keep the previous filter
 * 		sleep(1);
 * 		video_stream_change_source_filter(stream, noWebcamDevice, noWebCamFilter, TRUE); // keep the previous filter
 *
 *		sleep(1)
 *		video_stream_stop_keep_source(stream);
 *		ms_filter_destroy(noWebCamFilter);
 *		ms_filter_destroy(frontCamFilter);
 *
 *
 * @param stream the video stream to modify
 * @param cam the camera that you want to set as the new source
 * @param cam_filter the filter for this camera. It can be obtained with ms_web_cam_create_reader(cam)
 * @return the previous source if keep_previous_source is TRUE, otherwise NULL
 */
MS2_PUBLIC MSFilter* video_stream_change_source_filter(VideoStream *stream, MSWebCam* cam, MSFilter* filter, bool_t keep_previous_source );

/**
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
903 904
 * @brief This is the same function as \ref video_stream_change_source_filter() called with keep_source=1, but
 *  the new filter will be created from the MSWebcam that is passed as argument.
905
 *
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
906 907 908
 *  @param stream the video stream
 *  @param cam the MSWebcam from which the new source filter should be created.
 *  @return the previous source filter
909 910 911 912
 */
MS2_PUBLIC MSFilter* video_stream_change_camera_keep_previous_source(VideoStream *stream, MSWebCam *cam);


913 914
/* Calling video_stream_set_sent_video_size() or changing the bitrate value in the used PayloadType during a stream is running does nothing.
The following function allows to take into account new parameters by redrawing the sending graph*/