Commit a954810f authored by Ghislain MARY's avatar Ghislain MARY

API change to be able to specify local RTCP port for audio and video streams.

parent 82991edb
...@@ -157,11 +157,12 @@ MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno); ...@@ -157,11 +157,12 @@ MS2_PUBLIC void audio_stream_play_received_dtmfs(AudioStream *st, bool_t yesno);
/** /**
* Creates an AudioStream object listening on a RTP port. * Creates an AudioStream object listening on a RTP port.
* @param locport the local UDP port to listen for RTP packets. * @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
* @param ipv6 TRUE if ipv6 must be used. * @param ipv6 TRUE if ipv6 must be used.
* @returns a new AudioStream. * @returns a new AudioStream.
**/ **/
MS2_PUBLIC AudioStream *audio_stream_new(int locport, bool_t ipv6); MS2_PUBLIC AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
#define AUDIO_STREAM_FEATURE_PLC (1 << 0) #define AUDIO_STREAM_FEATURE_PLC (1 << 0)
#define AUDIO_STREAM_FEATURE_EC (1 << 1) #define AUDIO_STREAM_FEATURE_EC (1 << 1)
...@@ -329,7 +330,7 @@ typedef struct _VideoStream VideoStream; ...@@ -329,7 +330,7 @@ typedef struct _VideoStream VideoStream;
MS2_PUBLIC VideoStream *video_stream_new(int locport, bool_t use_ipv6); MS2_PUBLIC VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6);
MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, VideoStreamDir dir); MS2_PUBLIC void video_stream_set_direction(VideoStream *vs, VideoStreamDir dir);
MS2_PUBLIC void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno); MS2_PUBLIC void video_stream_enable_adaptive_bitrate_control(VideoStream *s, bool_t yesno);
MS2_PUBLIC void video_stream_set_render_callback(VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer); MS2_PUBLIC void video_stream_set_render_callback(VideoStream *s, VideoStreamRenderCallback cb, void *user_pointer);
......
...@@ -147,7 +147,7 @@ MS2_PUBLIC void ms_audio_conference_destroy(MSAudioConference *obj); ...@@ -147,7 +147,7 @@ MS2_PUBLIC void ms_audio_conference_destroy(MSAudioConference *obj);
* with the audiostream and is_remote=FALSE.<br> * with the audiostream and is_remote=FALSE.<br>
* For example:<br> * For example:<br>
* <PRE> * <PRE>
* AudioStream *st=audio_stream_new(65000,FALSE); * AudioStream *st=audio_stream_new(65000,65001,FALSE);
* audio_stream_start_full(st, conf->local_dummy_profile, * audio_stream_start_full(st, conf->local_dummy_profile,
* "127.0.0.1", * "127.0.0.1",
* 65000, * 65000,
......
...@@ -154,7 +154,7 @@ MSTickerPrio __ms_get_default_prio(bool_t is_video){ ...@@ -154,7 +154,7 @@ MSTickerPrio __ms_get_default_prio(bool_t is_video){
#endif #endif
} }
RtpSession * create_duplex_rtpsession( int locport, bool_t ipv6){ RtpSession * create_duplex_rtpsession( int loc_rtp_port, int loc_rtcp_port, bool_t ipv6){
RtpSession *rtpr; RtpSession *rtpr;
rtpr=rtp_session_new(RTP_SESSION_SENDRECV); rtpr=rtp_session_new(RTP_SESSION_SENDRECV);
rtp_session_set_recv_buf_size(rtpr,MAX_RTP_SIZE); rtp_session_set_recv_buf_size(rtpr,MAX_RTP_SIZE);
...@@ -162,7 +162,7 @@ RtpSession * create_duplex_rtpsession( int locport, bool_t ipv6){ ...@@ -162,7 +162,7 @@ RtpSession * create_duplex_rtpsession( int locport, bool_t ipv6){
rtp_session_set_blocking_mode(rtpr,0); rtp_session_set_blocking_mode(rtpr,0);
rtp_session_enable_adaptive_jitter_compensation(rtpr,TRUE); rtp_session_enable_adaptive_jitter_compensation(rtpr,TRUE);
rtp_session_set_symmetric_rtp(rtpr,TRUE); rtp_session_set_symmetric_rtp(rtpr,TRUE);
rtp_session_set_local_addr(rtpr,ipv6 ? "::" : "0.0.0.0",locport); rtp_session_set_local_addr(rtpr,ipv6 ? "::" : "0.0.0.0",loc_rtp_port,loc_rtcp_port);
rtp_session_signal_connect(rtpr,"timestamp_jump",(RtpCallback)rtp_session_resync,(long)NULL); rtp_session_signal_connect(rtpr,"timestamp_jump",(RtpCallback)rtp_session_resync,(long)NULL);
rtp_session_signal_connect(rtpr,"ssrc_changed",(RtpCallback)rtp_session_resync,(long)NULL); rtp_session_signal_connect(rtpr,"ssrc_changed",(RtpCallback)rtp_session_resync,(long)NULL);
rtp_session_set_ssrc_changed_threshold(rtpr,0); rtp_session_set_ssrc_changed_threshold(rtpr,0);
...@@ -611,7 +611,7 @@ AudioStream * audio_stream_start(RtpProfile *prof,int locport,const char *remip, ...@@ -611,7 +611,7 @@ AudioStream * audio_stream_start(RtpProfile *prof,int locport,const char *remip,
sndcard_playback=ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); sndcard_playback=ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get());
if (sndcard_capture==NULL || sndcard_playback==NULL) if (sndcard_capture==NULL || sndcard_playback==NULL)
return NULL; return NULL;
stream=audio_stream_new(locport, ms_is_ipv6(remip)); stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip));
if (audio_stream_start_full(stream,prof,remip,remport,remport+1,profile,jitt_comp,NULL,NULL,sndcard_playback,sndcard_capture,use_ec)==0) return stream; if (audio_stream_start_full(stream,prof,remip,remport,remport+1,profile,jitt_comp,NULL,NULL,sndcard_playback,sndcard_capture,use_ec)==0) return stream;
audio_stream_free(stream); audio_stream_free(stream);
return NULL; return NULL;
...@@ -628,7 +628,7 @@ AudioStream *audio_stream_start_with_sndcards(RtpProfile *prof,int locport,const ...@@ -628,7 +628,7 @@ AudioStream *audio_stream_start_with_sndcards(RtpProfile *prof,int locport,const
ms_error("No capture card."); ms_error("No capture card.");
return NULL; return NULL;
} }
stream=audio_stream_new(locport, ms_is_ipv6(remip)); stream=audio_stream_new(locport, locport+1, ms_is_ipv6(remip));
if (audio_stream_start_full(stream,prof,remip,remport,remport+1,profile,jitt_comp,NULL,NULL,playcard,captcard,use_ec)==0) return stream; if (audio_stream_start_full(stream,prof,remip,remport,remport+1,profile,jitt_comp,NULL,NULL,playcard,captcard,use_ec)==0) return stream;
audio_stream_free(stream); audio_stream_free(stream);
return NULL; return NULL;
...@@ -680,14 +680,14 @@ void audio_stream_set_features(AudioStream *st, uint32_t features){ ...@@ -680,14 +680,14 @@ void audio_stream_set_features(AudioStream *st, uint32_t features){
st->features = features; st->features = features;
} }
AudioStream *audio_stream_new(int locport, bool_t ipv6){ AudioStream *audio_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t ipv6){
AudioStream *stream=(AudioStream *)ms_new0(AudioStream,1); AudioStream *stream=(AudioStream *)ms_new0(AudioStream,1);
MSFilterDesc *ec_desc=ms_filter_lookup_by_name("MSOslec"); MSFilterDesc *ec_desc=ms_filter_lookup_by_name("MSOslec");
ms_filter_enable_statistics(TRUE); ms_filter_enable_statistics(TRUE);
ms_filter_reset_statistics(); ms_filter_reset_statistics();
stream->session=create_duplex_rtpsession(locport,ipv6); stream->session=create_duplex_rtpsession(loc_rtp_port,loc_rtcp_port,ipv6);
/*some filters are created right now to allow configuration by the application before start() */ /*some filters are created right now to allow configuration by the application before start() */
stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID); stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID);
stream->ice_check_list=NULL; stream->ice_check_list=NULL;
......
...@@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern RtpSession * create_duplex_rtpsession( int locport, bool_t ipv6); extern RtpSession * create_duplex_rtpsession( int loc_rtp_port, int loc_rtcp_port, bool_t ipv6);
#define MAX_RTP_SIZE UDP_MAX_SIZE #define MAX_RTP_SIZE UDP_MAX_SIZE
...@@ -215,9 +215,9 @@ static void choose_display_name(VideoStream *stream){ ...@@ -215,9 +215,9 @@ static void choose_display_name(VideoStream *stream){
#endif #endif
} }
VideoStream *video_stream_new(int locport, bool_t use_ipv6){ VideoStream *video_stream_new(int loc_rtp_port, int loc_rtcp_port, bool_t use_ipv6){
VideoStream *stream = (VideoStream *)ms_new0 (VideoStream, 1); VideoStream *stream = (VideoStream *)ms_new0 (VideoStream, 1);
stream->session=create_duplex_rtpsession(locport,use_ipv6); stream->session=create_duplex_rtpsession(loc_rtp_port,loc_rtcp_port,use_ipv6);
stream->evq=ortp_ev_queue_new(); stream->evq=ortp_ev_queue_new();
stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID); stream->rtpsend=ms_filter_new(MS_RTP_SEND_ID);
stream->ice_check_list=NULL; stream->ice_check_list=NULL;
......
...@@ -92,7 +92,7 @@ RtpSession *create_duplex_rtpsession(int locport){ ...@@ -92,7 +92,7 @@ RtpSession *create_duplex_rtpsession(int locport){
rtp_session_set_blocking_mode(rtpr,0); rtp_session_set_blocking_mode(rtpr,0);
rtp_session_enable_adaptive_jitter_compensation(rtpr,FALSE); rtp_session_enable_adaptive_jitter_compensation(rtpr,FALSE);
rtp_session_set_symmetric_rtp(rtpr,TRUE); rtp_session_set_symmetric_rtp(rtpr,TRUE);
rtp_session_set_local_addr(rtpr,"0.0.0.0",locport); rtp_session_set_local_addr(rtpr,"0.0.0.0",locport,locport+1);
rtp_session_signal_connect(rtpr,"timestamp_jump",(RtpCallback)rtp_session_resync,(long)NULL); rtp_session_signal_connect(rtpr,"timestamp_jump",(RtpCallback)rtp_session_resync,(long)NULL);
rtp_session_signal_connect(rtpr,"ssrc_changed",(RtpCallback)rtp_session_resync,(long)NULL); rtp_session_signal_connect(rtpr,"ssrc_changed",(RtpCallback)rtp_session_resync,(long)NULL);
return rtpr; return rtpr;
......
...@@ -593,7 +593,7 @@ void setup_media_streams(MediastreamDatas* args) { ...@@ -593,7 +593,7 @@ void setup_media_streams(MediastreamDatas* args) {
ms_snd_card_manager_get_card(manager,args->capture_card); ms_snd_card_manager_get_card(manager,args->capture_card);
MSSndCard *play= args->playback_card==NULL ? ms_snd_card_manager_get_default_playback_card(manager) : MSSndCard *play= args->playback_card==NULL ? ms_snd_card_manager_get_default_playback_card(manager) :
ms_snd_card_manager_get_card(manager,args->playback_card); ms_snd_card_manager_get_card(manager,args->playback_card);
args->audio=audio_stream_new(args->localport,ms_is_ipv6(args->ip)); args->audio=audio_stream_new(args->localport,args->localport+1,ms_is_ipv6(args->ip));
audio_stream_enable_automatic_gain_control(args->audio,args->agc); audio_stream_enable_automatic_gain_control(args->audio,args->agc);
audio_stream_enable_noise_gate(args->audio,args->use_ng); audio_stream_enable_noise_gate(args->audio,args->use_ng);
audio_stream_set_echo_canceller_params(args->audio,args->ec_len_ms,args->ec_delay_ms,args->ec_framesize); audio_stream_set_echo_canceller_params(args->audio,args->ec_len_ms,args->ec_delay_ms,args->ec_framesize);
...@@ -682,7 +682,7 @@ void setup_media_streams(MediastreamDatas* args) { ...@@ -682,7 +682,7 @@ void setup_media_streams(MediastreamDatas* args) {
exit(-1); exit(-1);
} }
ms_message("Starting video stream.\n"); ms_message("Starting video stream.\n");
args->video=video_stream_new(args->localport, ms_is_ipv6(args->ip)); args->video=video_stream_new(args->localport, args->localport+1, ms_is_ipv6(args->ip));
#ifdef ANDROID #ifdef ANDROID
if (args->device_rotation >= 0) if (args->device_rotation >= 0)
video_stream_set_device_rotation(args->video, args->device_rotation); video_stream_set_device_rotation(args->video, args->device_rotation);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment