add tolerance to download interval in tests and fix clean up percentage computing

parent fe3455c6
......@@ -158,7 +158,7 @@ static bool_t simple_analyser_process_rtcp(MSQosAnalyser *objbase, mblk_t *rtcp)
cur->rt_prop=rtp_session_get_round_trip_propagation(obj->session);
obj->points[obj->curindex-1][0]=rtp_session_get_send_bandwidth(obj->session)/1000.0;
obj->points[obj->curindex-1][1]=cur->lost_percentage;
obj->points[obj->curindex-1][1]=cur->lost_percentage/100.0;
obj->points[obj->curindex-1][2]=cur->rt_prop;
ms_message("MSQosAnalyser: lost_percentage=%f, int_jitter=%f ms, rt_prop=%f sec, send_bw=%f",cur->lost_percentage,cur->int_jitter,cur->rt_prop,obj->points[obj->curindex][0]);
......@@ -231,19 +231,20 @@ static void compute_available_bw(MSSimpleQosAnalyser *obj){
/*to compute estimated BW, we need a minimum x-axis interval size*/
if (diff > 0.05) {
double avail_bw = (fabs(m) > 0.0001f) ? -b/m : mean_bw;
printf("\tfor line is %f kbit/s:\ty=%f x + %f\n", avail_bw, m, b);
printf("\tEstimated BW by interpolation is %f kbit/s:\ty=%f x + %f\n", avail_bw, m, b);
lossy_network |= (m < .03f && b > 0.05);
lossy_network |= (m < .005f && b > 0.05);
if (!lossy_network && (m>.03f||b>0.05)){
if (!lossy_network && (m>.005f||b>0.05)){
obj->network_state = MS_QOS_ANALYSER_NETWORK_CONGESTED;
}
} else {
lossy_network |= (y_mean > 0.05);
}
lossy_network |= (y_mean > 0.05);
if (lossy_network) {
/*since congestion may loss a high count of packets, stay in congested network while
/*since congestion may loss a high number of packets, stay in congested network while
this is not a bit more stable*/
if (previous_state == MS_QOS_ANALYSER_NETWORK_CONGESTED) {
obj->network_state = MS_QOS_ANALYSER_NETWORK_CONGESTED;
......
......@@ -254,7 +254,7 @@ static void adaptive_opus_audio_stream() {
bw_usage = adaptive_audio_stream(OPUS_PAYLOAD_TYPE, 8000, EDGE_BW, 0, 14);
CU_ASSERT_IN_RANGE(bw_usage, 2.f, 3.f); // bad! since this codec cant change its ptime and it is the lower bitrate, no improvement can occur
bw_usage = adaptive_audio_stream(OPUS_PAYLOAD_TYPE, 48000, EDGE_BW, 0, 11);
CU_ASSERT_IN_RANGE(bw_usage, 1.f, 1.2f); // bad!
CU_ASSERT_IN_RANGE(bw_usage, 1.f, 1.4f); // bad!
// on 3G BW, both should be at max
bw_usage = adaptive_audio_stream(OPUS_PAYLOAD_TYPE, 8000, THIRDGENERATION_BW, 0, 5);
......@@ -269,8 +269,9 @@ static void adaptive_speex16_audio_stream() {
if( supported ) {
// at 16KHz -> 20 kb/s
// at 32KHz -> 30 kb/s
adaptive_audio_stream(SPEEX16_PAYLOAD_TYPE, 32000, EDGE_BW / 2., 0, 120);
float bw_usage;
bw_usage = adaptive_audio_stream(SPEEX16_PAYLOAD_TYPE, 32000, EDGE_BW / 2., 0, 10);
CU_ASSERT_IN_RANGE(bw_usage, 1.f, 5.f);
}
}
......@@ -288,24 +289,6 @@ static void adaptive_pcma_audio_stream() {
}
}
static void lossy_network_speex_audio_stream() {
bool_t supported = ms_filter_codec_supported("speex");
if( supported ) {
// at 16KHz -> 20 kb/s
// at 32KHz -> 30 kb/s
float bw_usage;
int loss_rate = getenv("GPP_LOSS") ? atoi(getenv("GPP_LOSS")) : 0;
int max_bw = getenv("GPP_MAXBW") ? atoi(getenv("GPP_MAXBW")) * 1000: 0;
printf("\nloss_rate=%d(GPP_LOSS) max_bw=%d(GPP_MAXBW)\n", loss_rate, max_bw);
bw_usage = adaptive_audio_stream(SPEEX16_PAYLOAD_TYPE, 32000, max_bw, loss_rate, 20);
CU_ASSERT_IN_RANGE(bw_usage, .9f, 1.f);
// bw_usage = adaptive_audio_stream(SPEEX16_PAYLOAD_TYPE, 16000, EDGE_BW, 8);
// CU_ASSERT_IN_RANGE(bw_usage, .9f, 1.f);
// bw_usage = adaptive_audio_stream(SPEEX16_PAYLOAD_TYPE, 32000, THIRDGENERATION_BW, 5);
// CU_ASSERT_IN_RANGE(bw_usage, .1f, .2f);
}
}
#if 0
static void audio_stream_dtmf(int codec_payload, int initial_bitrate,int target_bw, int max_recv_rtcp_packet) {
audio_stream_manager_t * marielle = audio_stream_manager_new();
......@@ -352,7 +335,6 @@ static test_t tests[] = {
{ "Adaptive audio stream [opus]", adaptive_opus_audio_stream },
{ "Adaptive audio stream [speex]", adaptive_speex16_audio_stream },
{ "Adaptive audio stream [pcma]", adaptive_pcma_audio_stream },
{ "Lossy network", lossy_network_speex_audio_stream },
};
test_suite_t audio_stream_test_suite = {
......
......@@ -133,7 +133,7 @@ static void handle_queue_events(video_stream_manager_t * stream_mgr, OrtpEvQueue
stream_mgr->latest_stats.rtt=rtp_session_get_round_trip_propagation(stream_mgr->stream->ms.sessions.rtp_session);
if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED)
stream_mgr->latest_stats.network_state=ms_qos_analyser_get_network_state(ms_bitrate_controller_get_qos_analyser(stream_mgr->stream->ms.rc));
ms_message("mediastreamer2_video_stream_tester: %s RTCP packet: loss=%f, RTT=%f, network_state=%d\n",
ms_message("mediastreamer2_video_stream_tester: %s RTCP packet: loss=%f, RTT=%f, network_state=%d",
(evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) ? "RECEIVED" : "EMITTED",
stream_mgr->latest_stats.loss,
stream_mgr->latest_stats.rtt,
......
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