Commit e20761fa authored by Simon Morlat's avatar Simon Morlat

rtcp processing in progress + fix for dtmf generation in wideband

parent 4edf1ae7
......@@ -94,8 +94,8 @@ static inline void ms_debug(const char *fmt,...)
#define ms_thread_join ortp_thread_join
typedef struct MSTimeSpec{
uint64_t tv_sec;
uint64_t tv_nsec;
int64_t tv_sec;
int64_t tv_nsec;
}MSTimeSpec;
struct _MSList {
......
......@@ -144,6 +144,24 @@ ms_time (time_t *t)
}
#endif
static void audio_stream_process_rtcp(AudioStream *stream, mblk_t *m){
do{
if (rtcp_is_SR(m)){
const report_block_t *rb;
rb=rtcp_SR_get_report_block(m,0);
if (rb){
unsigned int ij;
float rt=rtp_session_get_round_trip_propagation(stream->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_process_rtcp: interarrival jitter=%u , "
"lost packets percentage since last report=%f, round trip time=%f seconds",ij,flost,rt);
}
}
}while(rtcp_next_packet(m));
}
bool_t audio_stream_alive(AudioStream * stream, int timeout){
RtpSession *session=stream->session;
const rtp_stats_t *stats=rtp_session_get_stats(session);
......@@ -152,6 +170,7 @@ bool_t audio_stream_alive(AudioStream * stream, int timeout){
OrtpEvent *ev=ortp_ev_queue_get(stream->evq);
if (ev!=NULL){
if (ortp_event_get_type(ev)==ORTP_EVENT_RTCP_PACKET_RECEIVED){
audio_stream_process_rtcp(stream,ortp_event_get_data(ev)->packet);
stream->last_packet_time=ms_time(NULL);
}
ortp_event_destroy(ev);
......@@ -283,6 +302,10 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_filter_call_method(stream->volsend,MS_VOLUME_ENABLE_AGC,&tmp);
}
if (stream->dtmfgen)
ms_filter_call_method(stream->dtmfgen,MS_FILTER_SET_SAMPLE_RATE,&sample_rate);
if (stream->dtmfgen_rtp)
ms_filter_call_method(stream->dtmfgen_rtp,MS_FILTER_SET_SAMPLE_RATE,&sample_rate);
/* give the sound filters some properties */
if (ms_filter_call_method(stream->soundread,MS_FILTER_SET_SAMPLE_RATE,&sample_rate) != 0) {
/* need to add resampler*/
......
......@@ -332,7 +332,7 @@ void * ms_ticker_run(void *arg)
run_graphs(s,s->execution_list,FALSE);
#if TICKER_MEASUREMENTS
ms_get_cur_time(&end);
iload=100*((end.tv_sec-begin.tv_sec)*1000.0 + (end.tv_nsec-begin.tv_nsec)/1000000.0)/s->interval;
iload=100*((end.tv_sec-begin.tv_sec)*1000.0 + (end.tv_nsec-begin.tv_nsec)/1000000.0)/(double)s->interval;
s->av_load=(smooth_coef*s->av_load)+((1.0-smooth_coef)*iload);
#endif
}
......
......@@ -158,10 +158,11 @@ static void video_steam_process_rtcp(VideoStream *stream, mblk_t *m){
rb=rtcp_SR_get_report_block(m,0);
if (rb){
unsigned int ij;
float rt=rtp_session_get_round_trip_propagation(stream->session);
float flost;
ij=report_block_get_interarrival_jitter(rb);
flost=(float)(100.0*report_block_get_fraction_lost(rb)/256.0);
ms_message("interarrival jitter=%u , lost packets percentage since last report=%f ",ij,flost);
ms_message("video_steam_process_rtcp: interarrival jitter=%u , lost packets percentage since last report=%f, round trip time=%f seconds",ij,flost,rt);
if (stream->adapt_bitrate) video_stream_adapt_bitrate(stream,ij,flost);
}
}
......
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