[Freeswitch-dev] How to get value of the sample?

Anton freeneutron at gmail.com
Sun Dec 8 14:05:12 MSK 2013


Anthony Minessale <anthony.minessale <at> gmail.com> writes:

> 
> 
> Not enough to go on from that ....
> You probably want something more like.
> 
> 
> {
> int16_t *samples = (int16_t *) frame->data;
> int x = 0;
> 
> for (x = 0; x < frame->datalen / 2; x++) {
>    printf("[%d] ", samples[x]);
> }
> 
> printf("\n\n");
> 
> }
> 
> 
> 
> 
> 
> 
> 
> 
> On Sat, Nov 9, 2013 at 4:28 PM, Anton <e322 <at> ya.ru> wrote:Hallo. Why, 
when I'm trying to get a sample of the sound, I always get the
> same value -1?
> For example, in the mod_avmd.c is the string:
>     frame = switch_core_media_bug_get_read_replace_frame(bug);
> After this I add the following code
>     switch_log_printf(
>         SWITCH_CHANNEL_LOG,
>         SWITCH_LOG_NOTICE,
>         "data[0]=%d\n", ((int16_t *)(frame->data))[0]
>     );
> Then trigger the module mod_avmd and get a result in the console:
>     data[0]=-1;
> And so on for all the modules that contain the string:
>     frame = switch_core_media_bug_get_read_replace_frame(bug);
> independently of the level of sound in the channel.
> Why is that?
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting <at> 
freeswitch.orghttp://www.freeswitchsolutions.com
> http://
www.cudatel.com
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://
wiki.freeswitch.orghttp://www.cluecon.com
> FreeSWITCH-dev mailing listFreeSWITCH-dev <at> lists.freeswitch.orghttp://
lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-
devhttp://www.freeswitch.org
> 
> 
> -- Anthony Minessale IIFreeSWITCH http://www.freeswitch.org/ClueCon 
http://www.cluecon.com/
> Twitter: http://twitter.com/FreeSWITCH_wireAIM: 
anthmMSN:anthony_minessale <at> hotmail.comGTALK/JABBER/
PAYPAL:anthony.minessale <at> gmail.com
> IRC: irc.freenode.net #freeswitchFreeSWITCH Developer Conferencesip:888 
<at> conference.freeswitch.orggoogletalk:conf+888 <at> 
conference.freeswitch.org
> pstn:+19193869900
> 
> 
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting <at> freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev <at> lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
> 


I ran some tests, including one that led You. Even tried the following 
conversion types:
char * samples = (char *) frame-> data;
and anyway, the result is a -1 for all x, from 0 to frame->datalen-1

My task was to remake the module mod_avmd, ie file mod_avmd.c. And this 
problem has put me into a dead end, to the point where I moved my job to 
another server. In other operating environments do not have this problem. I 
wrote about this in more detail in the Issues:
http://jira.freeswitch.org/browse/FS-5944







Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev mailing list