aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 23:12:15 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-02 23:12:15 +0000
commitb262588ce6dd63d3efb6e8a6df8bd591ce76b7b3 (patch)
tree05dae21d0776b65543ff3377e2f1cef10aaff6db
parent192c79ea45937e569df72f353a03b678ff486dec (diff)
Merged revisions 179469 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r179469 | tilghman | 2009-03-02 17:10:18 -0600 (Mon, 02 Mar 2009) | 17 lines Merged revisions 179468 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r179468 | tilghman | 2009-03-02 17:09:01 -0600 (Mon, 02 Mar 2009) | 10 lines 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.6.1@179471 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/app.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/app.c b/main/app.c
index 2384a7d33..a81038804 100644
--- a/main/app.c
+++ b/main/app.c
@@ -830,8 +830,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]);
}