From: Tilghman Lesher Date: Wed, 14 Nov 2007 23:23:58 +0000 (+0000) Subject: When a recording ends with '#', we are improperly trimming an extra 200ms from the... X-Git-Tag: 1.4.14~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1af09c5f9d0ecdb3da10ab815c93206d5461fc36;p=thirdparty%2Fasterisk.git When a recording ends with '#', we are improperly trimming an extra 200ms from the recording. Reported by: sim Patch by: tilghman Closes issue #11247 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@89275 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/app.c b/main/app.c index 9136175ca7..0b57784a3c 100644 --- a/main/app.c +++ b/main/app.c @@ -705,8 +705,13 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, for (x = 0; x < fmtcnt; x++) { if (!others[x]) break; - if (res > 0) - ast_stream_rewind(others[x], totalsilence ? totalsilence - 200 : 200); + /*!\note + * If we ended with silence, trim all but the first 200ms of silence + * off the recording. However, if we ended with '#', we don't want + * to trim ANY part of the recording. + */ + if (res > 0 && totalsilence) + ast_stream_rewind(others[x], totalsilence - 200); ast_truncstream(others[x]); ast_closestream(others[x]); } @@ -721,7 +726,9 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, realfiles[x] = ast_readfile(recordfile, sfmt[x], comment, O_RDONLY, 0, 0); if (!others[x] || !realfiles[x]) break; - ast_stream_rewind(others[x], totalsilence ? totalsilence - 200 : 200); + /*!\note Same logic as above. */ + if (totalsilence) + ast_stream_rewind(others[x], totalsilence - 200); ast_truncstream(others[x]); /* add the original file too */ while ((fr = ast_readframe(realfiles[x]))) {