Commit 0a9abb91 authored by smorlat's avatar smorlat

set names to msticker



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@245 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 9407e6d6
......@@ -59,6 +59,8 @@ static int lpc_cmd_soundcard(LinphoneCore *, char *);
static int lpc_cmd_play(LinphoneCore *, char *);
static int lpc_cmd_record(LinphoneCore *, char *);
static int lpc_cmd_register(LinphoneCore *, char *);
static int lpc_cmd_duration(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
static void linphonec_proxy_display(LinphoneProxyConfig *lc);
......@@ -156,7 +158,8 @@ LPC_COMMAND commands[] = {
"'record <wav file>' : record into wav file."
},
{ "quit", lpc_cmd_quit, "Exit linphonec", NULL },
{ "register", lpc_cmd_register, "register <sip uri> <sip proxy>", NULL },
{ "register", lpc_cmd_register, "Register in one line to a proxy" , "register <sip identity> <sip proxy> <password>"},
{ "duration", lpc_cmd_duration, "Print duration in seconds of the last call.", NULL },
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
};
......@@ -1158,6 +1161,18 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
return 1;
}
int lpc_cmd_duration(LinphoneCore *lc, char *args){
LinphoneCallLog *cl;
const MSList *elem=linphone_core_get_call_logs(lc);
for(;elem!=NULL;elem=elem->next){
if (elem->next==NULL){
cl=(LinphoneCallLog*)elem->data;
linphonec_out("%i seconds\n",cl->duration);
}
}
return 1;
}
/***************************************************************************
*
* Command table management funx
......
......@@ -203,6 +203,9 @@ int main(int argc, char *argv[]){
return register_execute(argc-argi-1,&argv[argi+1]);
}else if (strcmp(argv[argi],"dial")==0){
return dial_execute(argc-argi-1,&argv[argi+1]);
}else if (strcmp(argv[argi],"hangup")==0){
send_generic_command("terminate",FALSE);
send_generic_command("duration",TRUE);
}
}
return 0;
......
......@@ -60,6 +60,7 @@ struct _MSTicker
uint64_t orig; /* a relative time to take in account difference between time base given by consecutive get_cur_time_ptr() functions.*/
MSTickerTimeFunc get_cur_time_ptr;
void *get_cur_time_data;
char *name;
bool_t run; /* flag to indicate whether the ticker must be run or not */
#ifdef WIN32_TIMERS
HANDLE TimeEvent;
......@@ -86,6 +87,11 @@ extern "C"{
*/
MSTicker *ms_ticker_new(void);
/**
* Set a name to the ticker (used for logging)
**/
void ms_ticker_set_name(MSTicker *ticker, const char *name);
/**
* Attach a chain of filters to a ticker.
* The processing chain will be executed until ms_ticker_detach
......
......@@ -279,7 +279,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/* create ticker */
stream->ticker=ms_ticker_new();
ms_ticker_set_name(stream->ticker,"Audio MSTicker");
ms_ticker_attach(stream->ticker,stream->soundread);
ms_ticker_attach(stream->ticker,stream->rtprecv);
......@@ -423,6 +423,7 @@ RingStream * ring_start_with_cb(const char *file,int interval,MSSndCard *sndcard
ms_filter_call_method(stream->source,MS_FILTER_GET_NCHANNELS,&tmp);
ms_filter_call_method(stream->sndwrite,MS_FILTER_SET_NCHANNELS,&tmp);
stream->ticker=ms_ticker_new();
ms_ticker_set_name(stream->ticker,"Audio (ring) MSTicker");
ms_filter_link(stream->source,0,stream->sndwrite,0);
ms_ticker_attach(stream->ticker,stream->source);
return stream;
......
......@@ -45,6 +45,7 @@ void ms_ticker_init(MSTicker *ticker)
#ifdef WIN32_TIMERS
ticker->TimeEvent=NULL;
#endif
ticker->name=ms_strdup("MSTicker");
ms_ticker_start(ticker);
}
......@@ -61,10 +62,15 @@ void ms_ticker_stop(MSTicker *s){
ms_thread_join(s->thread,NULL);
}
void ms_ticker_set_name(MSTicker *s, const char *name){
if (s->name) ms_free(s->name);
s->name=ms_strdup(name);
}
void ms_ticker_uninit(MSTicker *ticker)
{
ms_ticker_stop(ticker);
ms_free(ticker->name);
ms_mutex_destroy(&ticker->lock);
}
......@@ -349,7 +355,7 @@ void * ms_ticker_run(void *arg)
}else{
late=-diff;
if (late>s->interval*5 && late>lastlate){
ms_warning("We are late of %d miliseconds.",late);
ms_warning("%s: We are late of %d miliseconds.",s->name,late);
}
lastlate=late;
break; /*exit the while loop */
......@@ -360,7 +366,7 @@ void * ms_ticker_run(void *arg)
}
ms_mutex_unlock(&s->lock);
unset_high_prio(precision);
ms_message("MSTicker thread exiting");
ms_message("%s thread exiting",s->name);
ms_thread_exit(NULL);
return NULL;
......
......@@ -306,7 +306,8 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
ms_filter_link(stream->tee,1,stream->output,1);
/* create the ticker */
stream->ticker = ms_ticker_new();
stream->ticker = ms_ticker_new();
ms_ticker_set_name(stream->ticker,"Video MSTicker");
/* attach it the graph */
ms_ticker_attach (stream->ticker, stream->source);
return 0;
......@@ -390,7 +391,8 @@ VideoStream * video_preview_start(MSWebCam *device, MSVideoSize disp_size){
ms_filter_link(stream->pixconv, 0, stream->output, 0);
/* create the ticker */
stream->ticker = ms_ticker_new();
stream->ticker = ms_ticker_new();
ms_ticker_set_name(stream->ticker,"Video MSTicker");
ms_ticker_attach (stream->ticker, stream->source);
return stream;
}
......
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