Commit 92a94dea authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

remove audio_stream_process_rtcp method's body since its a duplication of media_stream_process_rtcp

parent e0d80e11
...@@ -122,25 +122,6 @@ static void audio_stream_configure_resampler(MSFilter *resampler,MSFilter *from, ...@@ -122,25 +122,6 @@ static void audio_stream_configure_resampler(MSFilter *resampler,MSFilter *from,
} }
static void audio_stream_process_rtcp(MediaStream *media_stream, mblk_t *m){ static void audio_stream_process_rtcp(MediaStream *media_stream, mblk_t *m){
AudioStream *stream=(AudioStream*)media_stream;
do{
const report_block_t *rb=NULL;
if (rtcp_is_SR(m)){
rb=rtcp_SR_get_report_block(m,0);
}else if (rtcp_is_RR(m)){
rb=rtcp_RR_get_report_block(m,0);
}
if (rb){
unsigned int ij;
float rt=rtp_session_get_round_trip_propagation(stream->ms.sessions.rtp_session);
float flost;
ij=report_block_get_interarrival_jitter(rb);
flost=(float)(100.0*report_block_get_fraction_lost(rb)/256.0);
ms_message("audio_stream_iterate[%p]: remote statistics available\n\tremote's interarrival jitter=%u\n"
"\tremote's lost packets percentage since last report=%f\n\tround trip time=%f seconds",stream,ij,flost,rt);
}
}while(rtcp_next_packet(m));
} }
void audio_stream_iterate(AudioStream *stream){ void audio_stream_iterate(AudioStream *stream){
...@@ -158,7 +139,7 @@ static mblk_t* audio_stream_payload_picker(MSRtpPayloadPickerContext* context,u ...@@ -158,7 +139,7 @@ static mblk_t* audio_stream_payload_picker(MSRtpPayloadPickerContext* context,u
static void stop_preload_graph(AudioStream *stream){ static void stop_preload_graph(AudioStream *stream){
ms_ticker_detach(stream->ms.sessions.ticker,stream->dummy); ms_ticker_detach(stream->ms.sessions.ticker,stream->dummy);
if (stream->ms.voidsink) { if (stream->ms.voidsink) {
ms_filter_unlink(stream->dummy,0,stream->ms.voidsink,0); ms_filter_unlink(stream->dummy,0,stream->ms.voidsink,0);
ms_filter_destroy(stream->ms.voidsink); ms_filter_destroy(stream->ms.voidsink);
...@@ -240,15 +221,15 @@ static void player_callback(void *ud, MSFilter *f, unsigned int id, void *arg){ ...@@ -240,15 +221,15 @@ static void player_callback(void *ud, MSFilter *f, unsigned int id, void *arg){
static void setup_local_player(AudioStream *stream, int samplerate, int channels){ static void setup_local_player(AudioStream *stream, int samplerate, int channels){
MSConnectionHelper cnx; MSConnectionHelper cnx;
int master=0; int master=0;
stream->local_player=ms_filter_new(MS_FILE_PLAYER_ID); stream->local_player=ms_filter_new(MS_FILE_PLAYER_ID);
stream->local_player_resampler=ms_filter_new(MS_RESAMPLE_ID); stream->local_player_resampler=ms_filter_new(MS_RESAMPLE_ID);
ms_connection_helper_start(&cnx); ms_connection_helper_start(&cnx);
ms_connection_helper_link(&cnx,stream->local_player,-1,0); ms_connection_helper_link(&cnx,stream->local_player,-1,0);
ms_connection_helper_link(&cnx,stream->local_player_resampler,0,0); ms_connection_helper_link(&cnx,stream->local_player_resampler,0,0);
ms_connection_helper_link(&cnx,stream->local_mixer,1,-1); ms_connection_helper_link(&cnx,stream->local_mixer,1,-1);
ms_filter_call_method(stream->local_player_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&samplerate); ms_filter_call_method(stream->local_player_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&samplerate);
ms_filter_call_method(stream->local_player_resampler,MS_FILTER_SET_OUTPUT_NCHANNELS,&channels); ms_filter_call_method(stream->local_player_resampler,MS_FILTER_SET_OUTPUT_NCHANNELS,&channels);
ms_filter_call_method(stream->local_mixer,MS_FILTER_SET_SAMPLE_RATE,&samplerate); ms_filter_call_method(stream->local_mixer,MS_FILTER_SET_SAMPLE_RATE,&samplerate);
...@@ -379,7 +360,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -379,7 +360,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
} else { } else {
stream->dtmfgen_rtp=NULL; stream->dtmfgen_rtp=NULL;
} }
if (ms_filter_call_method(stream->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&sample_rate)!=0){ if (ms_filter_call_method(stream->ms.rtpsend,MS_FILTER_GET_SAMPLE_RATE,&sample_rate)!=0){
ms_error("Sample rate is unknown for RTP side !"); ms_error("Sample rate is unknown for RTP side !");
return -1; return -1;
...@@ -406,7 +387,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -406,7 +387,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_error("audio_stream_start_full: No decoder or encoder available for payload %s.",pt->mime_type); ms_error("audio_stream_start_full: No decoder or encoder available for payload %s.",pt->mime_type);
return -1; return -1;
} }
/* check echo canceller max frequency and adjust sampling rate if needed when codec used is opus */ /* check echo canceller max frequency and adjust sampling rate if needed when codec used is opus */
if (stream->ec!=NULL) { if (stream->ec!=NULL) {
if ((ms_filter_get_id(stream->ms.encoder) == MS_OPUS_ENC_ID) && (ms_filter_get_id(stream->ec) == MS_WEBRTC_AEC_ID)) { /* AECM allow 8000 or 16000 Hz or it will be bypassed */ if ((ms_filter_get_id(stream->ms.encoder) == MS_OPUS_ENC_ID) && (ms_filter_get_id(stream->ec) == MS_WEBRTC_AEC_ID)) { /* AECM allow 8000 or 16000 Hz or it will be bypassed */
...@@ -419,7 +400,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -419,7 +400,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/*hack for opus, that claims stereo all the time, but we can't support stereo yet*/ /*hack for opus, that claims stereo all the time, but we can't support stereo yet*/
if (strcasecmp(pt->mime_type,"opus")==0) if (strcasecmp(pt->mime_type,"opus")==0)
nchannels=1; nchannels=1;
if (ms_filter_has_method(stream->ms.decoder, MS_FILTER_SET_RTP_PAYLOAD_PICKER)) { if (ms_filter_has_method(stream->ms.decoder, MS_FILTER_SET_RTP_PAYLOAD_PICKER)) {
ms_message("Decoder has FEC capabilities"); ms_message("Decoder has FEC capabilities");
picker_context.filter_graph_manager=stream; picker_context.filter_graph_manager=stream;
...@@ -436,7 +417,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -436,7 +417,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
stream->volrecv=NULL; stream->volrecv=NULL;
audio_stream_enable_echo_limiter(stream,stream->el_type); audio_stream_enable_echo_limiter(stream,stream->el_type);
audio_stream_enable_noise_gate(stream,stream->use_ng); audio_stream_enable_noise_gate(stream,stream->use_ng);
if (ms_filter_implements_interface(stream->soundread,MSFilterPlayerInterface) && infile){ if (ms_filter_implements_interface(stream->soundread,MSFilterPlayerInterface) && infile){
audio_stream_play(stream,infile); audio_stream_play(stream,infile);
} }
...@@ -484,7 +465,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -484,7 +465,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
} }
ms_filter_call_method(stream->ec,MS_FILTER_SET_SAMPLE_RATE,&sample_rate); ms_filter_call_method(stream->ec,MS_FILTER_SET_SAMPLE_RATE,&sample_rate);
} }
if (stream->features & AUDIO_STREAM_FEATURE_MIXED_RECORDING){ if (stream->features & AUDIO_STREAM_FEATURE_MIXED_RECORDING){
int val=0; int val=0;
int pin=1; int pin=1;
...@@ -499,7 +480,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -499,7 +480,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_filter_call_method(stream->send_tee,MS_TEE_MUTE,&pin); ms_filter_call_method(stream->send_tee,MS_TEE_MUTE,&pin);
ms_filter_call_method(stream->recorder,MS_FILTER_SET_SAMPLE_RATE,&sample_rate); ms_filter_call_method(stream->recorder,MS_FILTER_SET_SAMPLE_RATE,&sample_rate);
ms_filter_call_method(stream->recorder,MS_FILTER_SET_NCHANNELS,&nchannels); ms_filter_call_method(stream->recorder,MS_FILTER_SET_NCHANNELS,&nchannels);
} }
/* give the encoder/decoder some parameters*/ /* give the encoder/decoder some parameters*/
...@@ -538,7 +519,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -538,7 +519,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
} }
}else }else
stream->equalizer=NULL; stream->equalizer=NULL;
/*configure resamplers if needed*/ /*configure resamplers if needed*/
if (stream->read_resampler){ if (stream->read_resampler){
audio_stream_configure_resampler(stream->read_resampler,stream->soundread,stream->ms.encoder,8000,pt->clock_rate); audio_stream_configure_resampler(stream->read_resampler,stream->soundread,stream->ms.encoder,8000,pt->clock_rate);
...@@ -547,11 +528,11 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -547,11 +528,11 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
if (stream->write_resampler){ if (stream->write_resampler){
audio_stream_configure_resampler(stream->write_resampler,stream->ms.decoder,stream->soundwrite,pt->clock_rate,8000); audio_stream_configure_resampler(stream->write_resampler,stream->ms.decoder,stream->soundwrite,pt->clock_rate,8000);
} }
if (stream->ms.use_rc){ if (stream->ms.use_rc){
stream->ms.rc=ms_audio_bitrate_controller_new(stream->ms.sessions.rtp_session,stream->ms.encoder,0); stream->ms.rc=ms_audio_bitrate_controller_new(stream->ms.sessions.rtp_session,stream->ms.encoder,0);
} }
/* Create generic PLC if not handled by the decoder directly*/ /* Create generic PLC if not handled by the decoder directly*/
if ((stream->features & AUDIO_STREAM_FEATURE_PLC) != 0) { if ((stream->features & AUDIO_STREAM_FEATURE_PLC) != 0) {
int decoder_have_plc = 0; int decoder_have_plc = 0;
...@@ -573,7 +554,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -573,7 +554,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
} else { } else {
stream->plc = NULL; stream->plc = NULL;
} }
if (stream->features & AUDIO_STREAM_FEATURE_LOCAL_PLAYING){ if (stream->features & AUDIO_STREAM_FEATURE_LOCAL_PLAYING){
stream->local_mixer=ms_filter_new(MS_AUDIO_MIXER_ID); stream->local_mixer=ms_filter_new(MS_AUDIO_MIXER_ID);
} }
...@@ -584,7 +565,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -584,7 +565,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/*we were using the dummy preload graph, destroy it but keep sound filters*/ /*we were using the dummy preload graph, destroy it but keep sound filters*/
_audio_stream_unprepare_sound(stream,TRUE); _audio_stream_unprepare_sound(stream,TRUE);
} }
/* and then connect all */ /* and then connect all */
/* tip: draw yourself the picture if you don't understand */ /* tip: draw yourself the picture if you don't understand */
...@@ -634,7 +615,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -634,7 +615,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_filter_link(stream->recv_tee,1,stream->recorder_mixer,1); ms_filter_link(stream->recv_tee,1,stream->recorder_mixer,1);
ms_filter_link(stream->recorder_mixer,0,stream->recorder,0); ms_filter_link(stream->recorder_mixer,0,stream->recorder,0);
} }
/*to make sure all preprocess are done before befre processing audio*/ /*to make sure all preprocess are done before befre processing audio*/
ms_ticker_attach_multiple(stream->ms.sessions.ticker ms_ticker_attach_multiple(stream->ms.sessions.ticker
,stream->soundread ,stream->soundread
...@@ -775,7 +756,7 @@ void audio_stream_set_features(AudioStream *st, uint32_t features){ ...@@ -775,7 +756,7 @@ void audio_stream_set_features(AudioStream *st, uint32_t features){
AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions){ AudioStream *audio_stream_new_with_sessions(const MSMediaStreamSessions *sessions){
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();
...@@ -904,11 +885,11 @@ static void dismantle_local_player(AudioStream *stream){ ...@@ -904,11 +885,11 @@ static void dismantle_local_player(AudioStream *stream){
void audio_stream_stop(AudioStream * stream){ void audio_stream_stop(AudioStream * stream){
if (stream->ms.sessions.ticker){ if (stream->ms.sessions.ticker){
MSConnectionHelper h; MSConnectionHelper h;
if (stream->ms.state==MSStreamPreparing){ if (stream->ms.state==MSStreamPreparing){
audio_stream_unprepare_sound(stream); audio_stream_unprepare_sound(stream);
}else if (stream->ms.state==MSStreamStarted){ }else if (stream->ms.state==MSStreamStarted){
ms_ticker_detach(stream->ms.sessions.ticker,stream->soundread); ms_ticker_detach(stream->ms.sessions.ticker,stream->soundread);
ms_ticker_detach(stream->ms.sessions.ticker,stream->ms.rtprecv); ms_ticker_detach(stream->ms.sessions.ticker,stream->ms.rtprecv);
...@@ -958,7 +939,7 @@ void audio_stream_stop(AudioStream * stream){ ...@@ -958,7 +939,7 @@ void audio_stream_stop(AudioStream * stream){
if (stream->write_resampler!=NULL) if (stream->write_resampler!=NULL)
ms_connection_helper_unlink(&h,stream->write_resampler,0,0); ms_connection_helper_unlink(&h,stream->write_resampler,0,0);
ms_connection_helper_unlink(&h,stream->soundwrite,0,-1); ms_connection_helper_unlink(&h,stream->soundwrite,0,-1);
/*dismantle the call recording */ /*dismantle the call recording */
if (stream->recorder){ if (stream->recorder){
ms_filter_unlink(stream->send_tee,1,stream->recorder_mixer,0); ms_filter_unlink(stream->send_tee,1,stream->recorder_mixer,0);
...@@ -982,7 +963,7 @@ int audio_stream_send_dtmf(AudioStream *stream, char dtmf) ...@@ -982,7 +963,7 @@ int audio_stream_send_dtmf(AudioStream *stream, char dtmf)
return 0; return 0;
} }
void audio_stream_mute_rtp(AudioStream *stream, bool_t val) void audio_stream_mute_rtp(AudioStream *stream, bool_t val)
{ {
if (stream->ms.rtpsend){ if (stream->ms.rtpsend){
if (val) if (val)
......
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