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 <pvolc...@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_miness...@hotmail.com <msn%3aanthony_miness...@hotmail.com> GTALK/JABBER/PAYPAL:anthony.miness...@gmail.com<paypal%3aanthony.miness...@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:8...@conference.freeswitch.org <sip%3a...@conference.freeswitch.org> iax:gu...@conference.freeswitch.org/888 googletalk:conf+...@conference.freeswitch.org<googletalk%3aconf%2b...@conference.freeswitch.org> pstn:213-799-1400
_______________________________________________ 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