static void iterate_adaptive_stream(stream_manager_t * marielle, stream_manager_t * margaux, int timeout_ms, int* current, int expected){ int retry=0; MediaStream *marielle_ms,*margaux_ms; if (marielle->type == AudioStreamType){ marielle_ms=&marielle->audio_stream->ms; margaux_ms=&margaux->audio_stream->ms; }else{ marielle_ms=&marielle->video_stream->ms; margaux_ms=&margaux->video_stream->ms; } while ((!current||*current<expected) && retry++ <timeout_ms/100) { media_stream_iterate(marielle_ms); media_stream_iterate(margaux_ms); handle_queue_events(marielle); if (retry%10==0) { ms_message("stream [%p] bandwidth usage: [d=%.1f,u=%.1f] kbit/sec" , marielle_ms, media_stream_get_down_bw(marielle_ms)/1000, media_stream_get_up_bw(marielle_ms)/1000); ms_message("stream [%p] bandwidth usage: [d=%.1f,u=%.1f] kbit/sec" , margaux_ms, media_stream_get_down_bw(margaux_ms)/1000, media_stream_get_up_bw(margaux_ms)/1000); } ms_usleep(100000); } }
bool_t wait_for_list_with_parse_events(MSList *mss, int *counter, int value, int timeout_ms, MSList *cbs, MSList *ptrs) { MSList *msi; MSList *cbi; MSList *ptri; int retry = 0; while ((*counter < value) && (retry++ < (timeout_ms / 100))) { for (msi = mss, cbi = cbs, ptri = ptrs; msi != NULL; msi = msi->next) { MediaStream *stream = (MediaStream *)msi->data; ms_tester_iterate_cb cb = NULL; media_stream_iterate(stream); if ((retry % 10) == 0) { ms_message("stream [%p] bandwidth usage: [d=%.1f,u=%.1f] kbit/sec", stream, media_stream_get_down_bw(stream) / 1000, media_stream_get_up_bw(stream) / 1000); } if (cbi && ptri) { cb = (ms_tester_iterate_cb)cbi->data; cb(stream, ptri->data); } if (cbi) cbi = cbi->next; if (ptri) ptri = ptri->next; } ms_usleep(100000); } if (*counter < value) return FALSE; return TRUE; }
static void qos_analyzer_on_action_suggested(void *user_data, int datac, const char** datav){ reporting_session_report_t *report = (reporting_session_report_t*)user_data; LinphoneCall *call = report->call; char * appendbuf; int i; int ptime = -1; int bitrate[3] = {-1, -1, -1}; int up_bw[3] = {-1, -1, -1}; int down_bw[3] = {-1, -1, -1}; MediaStream *streams[3] = { (MediaStream*) call->audiostream, (MediaStream *) call->videostream, (MediaStream *) call->textstream }; for (i = 0; i < 3; i++){ if (streams[i] != NULL){ if (streams[i]->encoder != NULL){ if (ms_filter_has_method(streams[i]->encoder,MS_FILTER_GET_BITRATE)){ ms_filter_call_method(streams[i]->encoder,MS_FILTER_GET_BITRATE,&bitrate[i]); bitrate[i] /= 1000; } } up_bw[i] = (int)(media_stream_get_up_bw(streams[i])/1000.f); down_bw[i] = (int)(media_stream_get_down_bw(streams[i])/1000.f); } } if (call->audiostream!=NULL){ if (call->audiostream->ms.encoder!=NULL){ if(ms_filter_has_method(call->audiostream->ms.encoder,MS_AUDIO_ENCODER_GET_PTIME)){ ms_filter_call_method(call->audiostream->ms.encoder,MS_AUDIO_ENCODER_GET_PTIME,&ptime); } } } appendbuf=ms_strdup_printf("%s%d;", report->qos_analyzer.timestamp?report->qos_analyzer.timestamp:"", ms_time(0)); STR_REASSIGN(report->qos_analyzer.timestamp,appendbuf); STR_REASSIGN(report->qos_analyzer.input_leg, ms_strdup_printf("%s aenc_ptime aenc_br a_dbw a_ubw venc_br v_dbw v_ubw tenc_br t_dbw t_ubw", datav[0])); appendbuf=ms_strdup_printf("%s%s %d %d %d %d %d %d %d %d %d %d;", report->qos_analyzer.input?report->qos_analyzer.input:"", datav[1], ptime, bitrate[0], down_bw[0], up_bw[0], bitrate[1], down_bw[1], up_bw[1], bitrate[2], down_bw[2], up_bw[2]); STR_REASSIGN(report->qos_analyzer.input,appendbuf); STR_REASSIGN(report->qos_analyzer.output_leg, ms_strdup(datav[2])); appendbuf=ms_strdup_printf("%s%s;", report->qos_analyzer.output?report->qos_analyzer.output:"", datav[3]); STR_REASSIGN(report->qos_analyzer.output, appendbuf); }