Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. while(1) {
  2.                 mssofar = ast_tvdiff_ms(ast_tvnow(), start);
  3.                 if(mssofar > atoi(args.timeout)) {
  4.                         break;
  5.                 }
  6.                 res = ast_waitfor(chan, atoi(args.timeout) - mssofar);
  7.                 if (res < 1) {
  8.                         break;
  9.                 }
  10.                 f = ast_read(chan);
  11.                 if((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
  12.                         sdata = (short*)f->data.ptr;
  13.                         sptr = sdata;
  14.                         samples++;
  15.                         sptr++;
  16.                 }
  17.                 ast_frfree(f);
  18.         }