]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
I got a crash in iax that I think is related to this timestamp patch, so I am going...
authorRussell Bryant <russell@russellbryant.com>
Tue, 4 Jan 2005 17:18:15 +0000 (17:18 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 4 Jan 2005 17:18:15 +0000 (17:18 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4658 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
channels/chan_iax2.c

index 17df8232183cf6a789961708086b318220aa6167..1817045a73175d0c24f9dd7b8a7fa0d4307caac2 100755 (executable)
@@ -3377,7 +3377,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                                goto out;
                        }
                }
-               if (prefix) {
+               if (prefix && !ast_strlen_zero(prefixstr)) {
                        char fullusername[80] = "";
                        strncpy(fullusername, prefixstr, sizeof(fullusername) - 1);
                        strncat(fullusername, vms.username, sizeof(fullusername) - 1);
index 16c911d6a9285f433749c7e2886a68f312ec9c93..7a7eeffc81dbbcb644f15fa1f0647ff56ed27b93 100755 (executable)
@@ -2815,18 +2815,6 @@ static unsigned int fix_peerts(struct timeval *tv, int callno, unsigned int ts)
        return ms + ts;
 }
 
-static void add_ms(struct timeval *tv, int ms) {
-  tv->tv_usec += ms * 1000;
-  if(tv->tv_usec > 1000000) {
-      tv->tv_usec -= 1000000;
-      tv->tv_sec++;
-  }
-  if(tv->tv_usec < 0) {
-      tv->tv_usec += 1000000;
-      tv->tv_sec--;
-  }
-}
-
 static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, struct ast_frame *f)
 {
        struct timeval tv;
@@ -2847,8 +2835,6 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
                        delivery = &f->delivery;
                } else if (f->frametype == AST_FRAME_IAX) {
                        genuine = 1;
-               } else if (f->frametype == AST_FRAME_CNG) {
-                       p->notsilenttx = 0;     
                }
        }
        if (!p->offset.tv_sec && !p->offset.tv_usec) {
@@ -2873,33 +2859,15 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
                        ms = 0;
                if (voice) {
                        /* On a voice frame, use predicted values if appropriate */
-                       if (p->notsilenttx && abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) {
-                               /* Adjust our txcore, keeping voice and 
-                                       non-voice synchronized */
-                               add_ms(&p->offset, (int)(ms - p->nextpred)/10);
-
+                       if (abs(ms - p->nextpred) <= MAX_TIMESTAMP_SKEW) {
                                if (!p->nextpred) {
                                        p->nextpred = ms; /*f->samples / 8;*/
                                        if (p->nextpred <= p->lastsent)
                                                p->nextpred = p->lastsent + 3;
                                }
                                ms = p->nextpred;
-                       } else {
-                              /* in this case, just use the actual
-                               * time, since we're either way off
-                               * (shouldn't happen), or we're  ending a
-                               * silent period -- and seed the next
-                               * predicted time.  Also, round ms to the
-                               * next multiple of frame size (so our
-                               * silent periods are multiples of
-                               * frame size too) */
-                               int diff = ms % (f->samples / 8);
-                               if(diff)
-                                   ms += f->samples/8 - diff;
-
+                       } else
                                p->nextpred = ms;
-                               p->notsilenttx = 1;
-                       }
                } else {
                        /* On a dataframe, use last value + 3 (to accomodate jitter buffer shrinking) if appropriate unless
                           it's a genuine frame */