[asterisk-commits] qwell: branch 1.4 r111658 - /branches/1.4/formats/format_wav_gsm.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 28 11:19:57 CDT 2008


Author: qwell
Date: Fri Mar 28 11:19:56 2008
New Revision: 111658

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111658
Log:
The file size of WAV49 does not need to be an even number.

(closes issue #12128)
Reported by: mdu113
Patches:
      12128-noevenlength.diff uploaded by qwell (license 4)
Tested by: qwell, mdu113

Modified:
    branches/1.4/formats/format_wav_gsm.c

Modified: branches/1.4/formats/format_wav_gsm.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/formats/format_wav_gsm.c?view=diff&rev=111658&r1=111657&r2=111658
==============================================================================
--- branches/1.4/formats/format_wav_gsm.c (original)
+++ branches/1.4/formats/format_wav_gsm.c Fri Mar 28 11:19:56 2008
@@ -227,8 +227,8 @@
 	/* in a gsm WAV, data starts 60 bytes in */
 	bytes = end - MSGSM_DATA_OFFSET;
 	samples = htoll(bytes / MSGSM_FRAME_SIZE * MSGSM_SAMPLES);
-	datalen = htoll((bytes + 1) & ~0x1);
-	filelen = htoll(MSGSM_DATA_OFFSET - 8 + ((bytes + 1) & ~0x1));
+	datalen = htoll(bytes);
+	filelen = htoll(MSGSM_DATA_OFFSET - 8 + bytes);
 	if (cur < 0) {
 		ast_log(LOG_WARNING, "Unable to find our position\n");
 		return -1;
@@ -400,15 +400,6 @@
 	if (write_header(s->f))
 		return -1;
 	return 0;
-}
-
-static void wav_close(struct ast_filestream *s)
-{
-	char zero = 0;
-	/* Pad to even length */
-	fseek(s->f, 0, SEEK_END);
-	if (ftello(s->f) & 0x1)
-		fwrite(&zero, 1, 1, s->f);
 }
 
 static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)
@@ -552,7 +543,6 @@
 	.trunc = wav_trunc,
 	.tell = wav_tell,
 	.read = wav_read,
-	.close = wav_close,
 	.buf_size = 2*GSM_FRAME_SIZE + AST_FRIENDLY_OFFSET,
 	.desc_size = sizeof(struct wavg_desc),
 };




More information about the asterisk-commits mailing list