~ubuntu-branches/ubuntu/quantal/linphone/quantal

« back to all changes in this revision

Viewing changes to mediastreamer2/src/msticker.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Elie Mamane, Kilian Krause, Lionel Elie Mamane
  • Date: 2009-05-27 11:39:51 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090527113951-jd525e5rlwluh617
[ Kilian Krause ]
* Remove -N from wget args in get-orig-source target as -O is already
  used.

[ Lionel Elie Mamane ]
* linphone: Fix file conflict with linphone-common (<= 3.1.2-1)
  (Closes: #528076)

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#ifdef WIN32_TIMERS
46
46
        ticker->TimeEvent=NULL;
47
47
#endif
 
48
        ticker->name=ms_strdup("MSTicker");
48
49
        ms_ticker_start(ticker);
49
50
}
50
51
 
61
62
        ms_thread_join(s->thread,NULL);
62
63
}
63
64
 
 
65
void ms_ticker_set_name(MSTicker *s, const char *name){
 
66
        if (s->name) ms_free(s->name);
 
67
        s->name=ms_strdup(name);
 
68
}
64
69
 
65
70
void ms_ticker_uninit(MSTicker *ticker)
66
71
{
67
72
        ms_ticker_stop(ticker);
 
73
        ms_free(ticker->name);
68
74
        ms_mutex_destroy(&ticker->lock);
69
75
}
70
76
 
74
80
}
75
81
 
76
82
static void find_filters(MSList **filters, MSFilter *f ){
77
 
        int i;
 
83
        int i,found;
78
84
        MSQueue *link;
79
85
        if (f==NULL) ms_fatal("Bad graph.");
80
86
        /*ms_message("seeing %s, seen=%i",f->desc->name,f->seen);*/
89
95
                if (link!=NULL) find_filters(filters,link->prev.filter);
90
96
        }
91
97
        /* go downstream */
92
 
        for(i=0;i<f->desc->noutputs;i++){
 
98
        for(i=0,found=0;i<f->desc->noutputs;i++){
93
99
                link=f->outputs[i];
94
 
                if (link!=NULL) find_filters(filters,link->next.filter);
 
100
                if (link!=NULL) {
 
101
                        found++;
 
102
                        find_filters(filters,link->next.filter);
 
103
                }
 
104
        }
 
105
        if (f->desc->noutputs>=1 && found==0){
 
106
                ms_fatal("Bad graph: filter %s has %i outputs, none is connected.",f->desc->name,f->desc->noutputs);
95
107
        }
96
108
}
97
109
 
184
196
 
185
197
static void call_process(MSFilter *f){
186
198
        bool_t process_done=FALSE;
187
 
        if (f->desc->ninputs==0){
 
199
        if (f->desc->ninputs==0 || f->desc->flags & MS_FILTER_IS_PUMP){
188
200
                ms_filter_process(f);
189
201
        }else{
190
202
                while (ms_filter_inputs_have_data(f)) {
260
272
        return (ts.tv_sec*1000LL) + (ts.tv_nsec/1000000LL);
261
273
#else
262
274
        struct timespec ts;
263
 
        if (clock_gettime(CLOCK_REALTIME,&ts)<0){
 
275
        if (clock_gettime(CLOCK_MONOTONIC,&ts)<0){
264
276
                ms_fatal("clock_gettime() doesn't work: %s",strerror(errno));
265
277
        }
266
278
        return (ts.tv_sec*1000LL) + (ts.tv_nsec/1000000LL);
285
297
        TIMECAPS ptc;
286
298
        mm=timeGetDevCaps(&ptc,sizeof(ptc));
287
299
        if (mm==0){
288
 
                if (ptc.wPeriodMin<precision)
 
300
                if (ptc.wPeriodMin<(UINT)precision)
289
301
                        ptc.wPeriodMin=precision;
290
302
                else
291
303
                        precision = ptc.wPeriodMin;
345
357
                        diff=s->time-realtime;
346
358
                        if (diff>0){
347
359
                                /* sleep until next tick */
348
 
                                sleepMs(diff);
 
360
                                sleepMs((int)diff);
349
361
                        }else{
350
 
                                late=-diff;
 
362
                                late=(int)-diff;
351
363
                                if (late>s->interval*5 && late>lastlate){
352
 
                                        ms_warning("We are late of %d miliseconds.",late);
 
364
                                        ms_warning("%s: We are late of %d miliseconds.",s->name,late);
353
365
                                }
354
366
                                lastlate=late;
355
367
                                break; /*exit the while loop */
360
372
        }
361
373
        ms_mutex_unlock(&s->lock);
362
374
        unset_high_prio(precision);
363
 
        ms_message("MSTicker thread exiting");
 
375
        ms_message("%s thread exiting",s->name);
364
376
 
365
377
        ms_thread_exit(NULL);
366
378
        return NULL;