[Home]

Summary:ASTERISK-03430: Minor annoyance in format_g729.c
Reporter:entropy (entropy)Labels:
Date Opened:2005-02-04 04:42:43.000-0600Date Closed:2008-01-15 15:24:36.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/CodecInterface
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I have recorded a bunch of IVRs in G729 format, I proceeded to load them into asterisk. As i Playback()ed them, the messade in Additional Information came up. I read the source code for format_g729.c, and the condition preceeding line 134 is:

if ((res = read(s->fd, s->g729, 20)) != 20)

Being a C programmer myself, I looked at my IVR file and saw that it was 1830 bytes. The format_g729.c module reads IVR files in 20 byte chunks and spits out an error if it's not. So I opened my IVR file with a hex editor and padded it with 0s to 1840 bytes, a perfect multiple of 20(92). The error did not appear as I expected. My question/report is such: Isn't it presumptuous to believe that every file will come in chunks of 20 bytes? Even if the amount read() is not 20, that just means you're at EOF, nothing's wrong. I think that the WARNING notice is not justified. Please forgive me if there is some written specification i'm not aware of that suggests otherwise, I would simply like to know if this is indeed a bug and if not, how is the error justified?

Thank you.

****** ADDITIONAL INFORMATION ******

WARNING[2615]: format_g729.c:134 g729_read: Short read (10) (No such file or directory)!
Comments:By: Kevin P. Fleming (kpfleming) 2005-02-04 08:52:04.000-0600

I too see these messages... I believe they are caused by the fact that the writer of format_g729 assumed that the only G.729 raw files that would be played are those that had been created by this module (and thus Asterisk), and would be in 20ms samples. However, there are other ways of creating G.729 raw files, and they do not produce files in 20ms "blocks".

I too think this message should be removed, especially since the strerror() translation of the error number is very misleading.

By: Mark Spencer (markster) 2005-02-04 09:45:11.000-0600

Fixed in CVS head.

By: Russell Bryant (russell) 2005-02-06 22:28:57.000-0600

fixed in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:24:22.000-0600

Repository: asterisk
Revision: 4965

U   trunk/formats/format_g729.c

------------------------------------------------------------------------
r4965 | markster | 2008-01-15 15:24:21 -0600 (Tue, 15 Jan 2008) | 2 lines

Make sure 10 byte read is considered EOF not error (bug ASTERISK-3430)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4965

By: Digium Subversion (svnbot) 2008-01-15 15:24:36.000-0600

Repository: asterisk
Revision: 4978

U   branches/v1-0/formats/format_g729.c

------------------------------------------------------------------------
r4978 | russell | 2008-01-15 15:24:36 -0600 (Tue, 15 Jan 2008) | 2 lines

Make sure 10 byte read is considered EOF not error (bug ASTERISK-3430)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4978