aboutsummaryrefslogtreecommitdiffstats
path: root/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'translate.c')
-rwxr-xr-xtranslate.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/translate.c b/translate.c
index 7546b59a2..fc9c5f22b 100755
--- a/translate.c
+++ b/translate.c
@@ -304,7 +304,8 @@ struct ast_frame_chain *ast_translate(struct ast_trans_pvt *path, struct ast_fra
#define FUDGE 0
-static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *path, struct ast_frame *f, int fd, struct ast_channel *c, struct timeval *last)
+static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *path, struct ast_frame *f, int fd, struct ast_channel *c,
+ struct timeval *last)
{
struct ast_trans_pvt *p;
struct ast_frame *out;
@@ -328,7 +329,7 @@ static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *p
#ifdef EXPERIMENTAL_TRANSLATION
if (ms + FUDGE < out->timelen)
schedule_delivery(pvt->sched, pvt,
- c, fd, out, ms);
+ c, fd, out, out->timelen - ms);
else {
if (c)
ast_write(c, out);
@@ -340,13 +341,17 @@ static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *p
/* Schedule this packet to be delivered at the
right time */
} else
+ gettimeofday(last, NULL);
#else
+#if 0
/* XXX Not correct in the full duplex case XXX */
if (ms + FUDGE < out->timelen)
usleep((out->timelen - ms - FUDGE) * 1000);
+#endif
last->tv_sec = tv.tv_sec;
last->tv_usec = tv.tv_usec;
- }
+ } else
+ gettimeofday(last, NULL);
#endif
if (c)
ast_write(c, out);