On Tue, 2009-10-13 at 11:31 -0700, Peter Volchek wrote:
The second one, checks for the "0" value in the denominator; the first one doesn't, so the potential segfault exists.
That wouldnt be a segfault, but it would be a critical error. Mosts systems map that to an FPE :) good catch, did you see if anything that calls it does a check before hand? It may be that its only called by things that check, I know at one point in the code some tests were done many times, it appeared to me that there was not a defined policy of when things should do the checking so it ended up duplicating the error checks which results in slightly slower code. -- Trixter http://www.0xdecafbad.com Bret McDanel pgp key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8AE5C721
This was broken on many levels. First off the obvious one besides the potential FPE was it's using fh->samples_in not fh->samples_out but that value was not being computed correctly anyway and to top it off the value has to be determined after we close the file and not before to make sure we pick up any buffered audio. FYI, can you please report incidents like this in the future to jira http://jira.freeswitch.org so we can track them easier. On Tue, Oct 13, 2009 at 1:31 PM, Peter Volchek <pvolchek@voicemobility.com>wrote:
Hi, I am currently trying to retrieve the length of the most recent recording, and I am using 'record_ms' channel variable. However, the returned value is always '0'.
Here is the code I am using (lua):
... session:recordFile(file, 30, 10, 10 ); local rlen = session:getVariable("record_ms"); -- rlen is Always 0 ...
Any ideas why?
Looking at switch_ivr_play_say.c, I found the line that sets this variable at the end of recording:
switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_in / read_impl.samples_per_second); switch_channel_set_variable_printf(channel, "record_samples", "%d", fh->samples_in);
I also dumped the "record_samples" variable, which was also 0, so there are no surprises that record_ms was 0 too. Please also compare the first function call to the analogous with "playback_ms"
*if (read_impl.samples_per_second) switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / read_impl.samples_per_second);
*The second one, checks for the "0" value in the denominator; the first one doesn't, so the potential segfault exists.* *
Cheers, PV
_______________________________________________ FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
participants (3)
-
Anthony Minessale
-
Peter Volchek
-
Trixter aka Bret McDanel