Commit 0765d7dc authored by Simon Morlat's avatar Simon Morlat

support for outbound simulator of ortp

parent 307af71a
......@@ -299,24 +299,6 @@ static uint64_t get_cur_time_ms(void *unused){
return ms_get_cur_time_ms();
}
static void sleepMs(int ms){
#ifdef WIN32
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
Sleep(ms);
#else
HANDLE sleepEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
if (!sleepEvent) return;
WaitForSingleObjectEx(sleepEvent, ms, FALSE);
CloseHandle(sleepEvent);
#endif
#else
struct timespec ts;
ts.tv_sec=0;
ts.tv_nsec=ms*1000000LL;
nanosleep(&ts,NULL);
#endif
}
static int set_high_prio(MSTicker *obj){
int precision=2;
int prio=obj->prio;
......@@ -411,7 +393,7 @@ static int wait_next_tick(void *data, uint64_t virt_ticker_time){
diff=s->time-realtime;
if (diff>0){
/* sleep until next tick */
sleepMs((int)diff);
ortp_sleep_ms((int)diff);
}else{
late=(int)-diff;
break; /*exit the while loop */
......
......@@ -211,7 +211,8 @@ const char *usage="mediastream --local <port> --remote <ip:port> \n"
"[ --netsim-consecutive-loss-probability <0-1> (to simulate bursts of lost packets)]\n"
"[ --netsim-latency <latency in ms> (simulates a network latency)]\n"
"[ --netsim-jitter-strength <0-100> (strength of the jitter simulation)]\n"
"[ --netsim-jitter-burst-density <0-10> (density of gap/burst events, 1.0=one gap/burst per second in average)]\n"
"[ --netsim-jitter-burst-density <0-10> (density of gap/burst events, 1.0=one gap/burst per second in average)]\n"
"[ --netsim-mode inbound|outboud (whether network simulation is applied to incoming (default) or outgoing stream)]\n"
"[ --zoom zoomfactor]\n"
"[ --ice-local-candidate <ip:port:[host|srflx|prflx|relay]> ]\n"
"[ --ice-remote-candidate <ip:port:[host|srflx|prflx|relay]> ]\n"
......@@ -568,6 +569,22 @@ bool_t parse_args(int argc, char** argv, MediastreamDatas* out) {
ms_error("Missing argument for --netsim-jitter-strength");
return FALSE;
}
}else if (strcmp(argv[i], "--netsim-mode") == 0) {
i++;
if (i<argc){
if (strcmp(argv[i],"inbound")==0)
out->netsim.mode=OrtpNetworkSimulatorInbound;
else if (strcmp(argv[i],"outbound")==0){
out->netsim.mode=OrtpNetworkSimulatorOutbound;
}else{
ms_error("Invalid value for --netsim-mode");
return FALSE;
}
out->netsim.enabled=TRUE;
}else{
ms_error("Missing argument for --netsim-dir");
return FALSE;
}
}else if (strcmp(argv[i],"--zoom")==0){
i++;
if (sscanf(argv[i], "%f,%f,%f", &out->zoom, &out->zoom_cx, &out->zoom_cy) != 3) {
......
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