aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-24 00:59:58 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-24 00:59:58 +0000
commit5fd69945ddf7f199cb1b0db14b68d03f31fc3074 (patch)
tree6ca356c0ecf2011cea1076799335423b77f472fb /main
parente8b71c573a84abaac074d046399adfff4fd5820e (diff)
Merged revisions 51843 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r51843 | russell | 2007-01-23 18:57:28 -0600 (Tue, 23 Jan 2007) | 6 lines Fix an issue related to synchronization of recordings when using Monitor(). The bug is a miscalculation of the amount to seek the stream for writing to disk when the number of samples coming in and out of a channel do not match up. (issue #8298, #8887, report and patch by guillecabeza, patch files created and testing done by whoiswes) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51848 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/main/channel.c b/main/channel.c
index 925d5d363..39c4e8e16 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2290,9 +2290,10 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
#ifndef MONITOR_CONSTANT_DELAY
int jump = chan->outsmpl - chan->insmpl - 4 * f->samples;
if (jump >= 0) {
- if (ast_seekstream(chan->monitor->read_stream, jump + f->samples, SEEK_FORCECUR) == -1)
+ jump = chan->outsmpl - chan->insmpl;
+ if (ast_seekstream(chan->monitor->read_stream, jump, SEEK_FORCECUR) == -1)
ast_log(LOG_WARNING, "Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");
- chan->insmpl += jump + 4 * f->samples;
+ chan->insmpl += jump + f->samples;
} else
chan->insmpl+= f->samples;
#else
@@ -2710,9 +2711,10 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
#ifndef MONITOR_CONSTANT_DELAY
int jump = chan->insmpl - chan->outsmpl - 4 * f->samples;
if (jump >= 0) {
- if (ast_seekstream(chan->monitor->write_stream, jump + f->samples, SEEK_FORCECUR) == -1)
+ jump = chan->insmpl - chan->outsmpl;
+ if (ast_seekstream(chan->monitor->write_stream, jump, SEEK_FORCECUR) == -1)
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
- chan->outsmpl += jump + 4 * f->samples;
+ chan->outsmpl += jump + f->samples;
} else
chan->outsmpl += f->samples;
#else