diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-02 23:09:01 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-02 23:09:01 +0000 |
commit | 3d9ed4987972cb6e0e1c718e76618a6c6dc85485 (patch) | |
tree | 598e8d4c17918fd80a0cdb906468ec895dc17bb7 /main/app.c | |
parent | 2736bc484101820cfbc1ee76d077c6bafb561b29 (diff) |
When ending a recording with silence detection, remember to reduce the duration.
The end of the recording is correspondingly trimmed, but the duration was not
trimmed by the number of seconds trimmed, so the saved duration was necessarily
longer than the actual soundfile duration.
(closes issue #14406)
Reported by: sasargen
Patches:
20090226__bug14406.diff.txt uploaded by tilghman (license 14)
Tested by: sasargen
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@179468 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r-- | main/app.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/main/app.c b/main/app.c index bcecff568..2c448d549 100644 --- a/main/app.c +++ b/main/app.c @@ -731,8 +731,16 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, * off the recording. However, if we ended with '#', we don't want * to trim ANY part of the recording. */ - if (res > 0 && totalsilence) + if (res > 0 && totalsilence) { ast_stream_rewind(others[x], totalsilence - 200); + /* Reduce duration by a corresponding amount */ + if (x == 0 && *duration) { + *duration -= (totalsilence - 200) / 1000; + if (*duration < 0) { + *duration = 0; + } + } + } ast_truncstream(others[x]); ast_closestream(others[x]); } |