Skip to content
Snippets Groups Projects
  1. Jul 22, 2015
    • Joshua Colp's avatar
      audiohook: Read the correct number of samples based on audiohook format. · 5606da75
      Joshua Colp authored
      Due to changes in audiohooks to support different sample rates the
      underlying storage of samples is in the format of the audiohook
      itself and not of the format being requested. This means that if a
      channel is using G722 the samples stored will be at 16kHz. If
      something subsequently reads from the audiohook at a format which
      is not the same sample rate as the audiohook the number of samples
      needs to be adjusted.
      
      Given the following example:
      1. Channel writing into audiohook at 16kHz (as it is using G722).
      2. Chanspy reading from audiohook at 8kHz.
      
      The original code would read 160 samples from the audiohook for
      each 20ms of audio. This is incorrect. Since the audio in the
      audiohook is at 16kHz the actual number needing to be read is 320.
      Failure to read this much would cause the audiohook to reset
      itself constantly as the buffer became full.
      
      This change adjusts the requested number of samples by determining
      the duration of audio requested and then calculating how many
      samples that would be in the audiohook format.
      
      ASTERISK-25247 #close
      
      Change-Id: Ia91ce516121882387a315fd8ee116b118b90653d
      5606da75
  2. May 20, 2015
    • Kevin Harwell's avatar
      audiohook.c: Difference in read/write rates caused continuous buffer resets · 58970f14
      Kevin Harwell authored
      Currently, everytime a sample rate change occurs (on read or write) the
      associated factory buffers are reset. If the requested sample rate on a
      read differed from that of a write then the buffers are continually reset
      on every read and write. This has the side effect of emptying the buffer,
      thus there being no data to read and then write to a file in the case of
      call recording.
      
      This patch fixes it so that an audiohook_list's rate always maintains the
      maximum sample rate among hooks and formats. Audiohook sample rates are
      only overwritten by this value when slin native compatibility is turned on.
      Also, the audiohook sample rate can only overwrite the list's sample rate
      when its rate is greater than that of the list or if compatibility is
      turned off. This keeps the rate from constantly switching/resetting.
      
      ASTERISK-24944 #close
      Reported by: Ronald Raikes
      
      Change-Id: Idab4dfef068a7922c09cc631dda27bc920a6c76f
      58970f14
  3. Mar 12, 2015
    • Matthew Jordan's avatar
      main/audiohook: Update internal sample rate on reads · f9f21aaf
      Matthew Jordan authored
      When an audiohook is created (which is used by the various Spy applications
      and Snoop channel in Asterisk 13+), it initially is given a sample rate of
      8kHz. It is expected, however, that this rate may change based on the media
      that passes through the audiohook. However, the read/write operations on the
      audiohook behave very differently.
      
      When a frame is written to the audiohook, the format of the frame is checked
      against the internal sample rate. If the rate of the format does not match
      the internal sample rate, the internal sample rate is updated and a new SLIN
      format is chosen based on that sample rate. This works just fine.
      
      When a frame is read, however, we do something quite different. If the format
      rate matches the internal sample rate, all is fine. However, if the rates
      don't match, the audiohook attempts to "fix up" the number of samples that
      were requested. This can result in some seriously large number of samples
      being requested from the read/write factories.
      
      Consider the worst case - 192kHz SLIN. If we attempt to read 20ms worth of
      audio produced at that rate, we'd request 3840 samples (192000 / (1000 / 20)).
      However, if the audiohook is still expecting an internal sample rate of 8000,
      we'll attempt to "fix up" the requested samples to:
      
        samples_converted = samples * (ast_format_get_sample_rate(format) /
                                       (float) audiohook->hook_internal_samp_rate);
      
        which is:
      
        92160 = 3840 * (192000 / 8000)
      
      This results in us attempting to read 92160 samples from our factories, as
      opposed to the 3840 that we actually wanted. On a 64-bit machine, this
      miraculously survives - despite allocating up to two buffers of length 92160
      on the stack. The 32-bit machines aren't quite so lucky. Even in the case where
      this works, we will either (a) get way more samples than we wanted; or (b) get
      about 3840 samples, assuming the timing is pretty good on the machine.
      
      Either way, the calculation being performed is wrong, based on the API users
      expectations.
      
      My first inclination was to allocate the buffers on the heap. As it is,
      however, there's at least two drawbacks with doing this:
      (1) It's a bit complicated, as the size of the buffers may change during the
          lifetime of the audiohook (ew).
      (2) The stack is faster (yay); the heap is slower (boo).
      
      Since our calculation is flat out wrong in the first place, this patch fixes
      this issue by instead updating the internal sample rate based on the format
      passed into the read operation. This causes us to read the correct number of
      samples, and has the added benefit of setting the audihook with the right
      SLIN format.
      
      Note that this issue was caught by the Asterisk Test Suite as a result of
      r432195 in the 13 branch. Because this issue is also theoretically possible
      in Asterisk 11, the change is being made here as well.
      
      Review: https://reviewboard.asterisk.org/r/4475/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@432810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      f9f21aaf
  4. May 09, 2014
  5. Jun 15, 2012
    • Kevin P. Fleming's avatar
      Multiple revisions 369001-369002 · 166b4e2b
      Kevin P. Fleming authored
      ........
        r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines
        
        Add support-level indications to many more source files.
        
        Since we now have tools that scan through the source tree looking for files
        with specific support levels, we need to ensure that every file that is
        a component of a 'core' or 'extended' module (or the main Asterisk binary)
        is explicitly marked with its support level. This patch adds support-level
        indications to many more source files in tree, but avoids adding them to
        third-party libraries that are included in the tree and to source files
        that don't end up involved in Asterisk itself.
      ........
        r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines
        
        Add a script to enable finding source files without support-levels defined.
      ........
      
      Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      ........
      
      Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      166b4e2b
  6. May 02, 2012
  7. Mar 22, 2012
  8. Feb 20, 2012
  9. Feb 16, 2012
  10. Dec 28, 2011
  11. Dec 27, 2011
  12. May 03, 2011
  13. Mar 14, 2011
  14. Mar 11, 2011
  15. Feb 22, 2011
    • David Vossel's avatar
      Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd... · d760e81f
      David Vossel authored
      Media Project Phase2: SILK 8khz-24khz, SLINEAR 8khz-192khz, SPEEX 32khz, hd audio ConfBridge, and other stuff
      
      -Functional changes
      1. Dynamic global format list build by codecs defined in codecs.conf
      2. SILK 8khz, 12khz, 16khz, and 24khz with custom attributes defined in codecs.conf
      3. Negotiation of SILK attributes in chan_sip.
      4. SPEEX 32khz with translation
      5. SLINEAR 8khz, 12khz, 24khz, 32khz, 44.1khz, 48khz, 96khz, 192khz with translation
         using codec_resample.c
      6. Various changes to RTP code required to properly handle the dynamic format list
         and formats with attributes.
      7. ConfBridge now dynamically jumps to the best possible sample rate.  This allows
         for conferences to take advantage of HD audio (Which sounds awesome)
      8. Audiohooks are no longer limited to 8khz audio, and most effects have been
         updated to take advantage of this such as Volume, DENOISE, PITCH_SHIFT.
      9. codec_resample now uses its own code rather than depending on libresample.
      
      -Organizational changes
      Global format list is moved from frame.c to format.c
      Various format specific functions moved from frame.c to format.c
      
      Review: https://reviewboard.asterisk.org/r/1104/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@308582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      d760e81f
  16. Feb 04, 2011
  17. Feb 03, 2011
  18. Jul 27, 2010
  19. Jun 08, 2010
  20. Apr 29, 2010
  21. Apr 21, 2010
  22. Jan 08, 2010
    • David Vossel's avatar
      fixes AUDIOHOOK_INHERIT regression · bf067477
      David Vossel authored
      During the process of removing an audiohook from one channel
      and attaching it to another the audiohook's status is updated
      to DONE and then back to whatever it was previously.  Typically
      updating the status after setting it to DONE is not a good idea
      because DONE can trigger unrecoverable audiohook destruction
      events... because of this a conditional check was added to
      audiohook_update_status to explicitly prevent the audiohook
      from ever changing after being set to DONE.  It was this check
      that prevented audiohook inherit from work properly though.
      
      Now ast_audiohook_move_by_source is treated as a special exception,
      as the audiohook must be returned to its previous status after
      attaching it to the new channel.  This is only a safe operation
      because the audiohook's lock is held the entire time, otherwise
      this could cause trouble.
      
      (closes issue #16522)
      Reported by: corruptor
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      bf067477
  23. Nov 20, 2009
  24. Nov 04, 2009
  25. Oct 20, 2009
  26. May 28, 2009
    • Mark Michelson's avatar
      Merged revisions 197537 via svnmerge from · a7fd763e
      Mark Michelson authored
      https://origsvn.digium.com/svn/asterisk/branches/1.4
      
      ........
        r197537 | mmichelson | 2009-05-28 09:49:13 -0500 (Thu, 28 May 2009) | 21 lines
        
        Add flags to chanspy audiohook so that audio stays in sync.
        
        There are two flags being added to the chanspy audiohook here. One
        is the pre-existing AST_AUDIOHOOK_TRIGGER_SYNC flag. With this set,
        we ensure that the read and write slinfactories on the audiohook do
        not skew beyond a certain tolerance.
        
        In addition, there is a new audiohook flag added here,
        AST_AUDIOHOOK_SMALL_QUEUE. With this flag set, we do not allow for
        a slinfactory to build up a substantial amount of audio before 
        flushing it. For this particular issue, this means that the person 
        spying on the call will hear the conversations in real time with very 
        little delay in the audio.
        
        (closes issue #13745)
        Reported by: geoffs
        Patches:
              13745.patch uploaded by mmichelson (license 60)
        Tested by: snblitz
      ........
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      a7fd763e
  27. May 01, 2009
  28. Apr 10, 2009
  29. Apr 03, 2009
  30. Mar 31, 2009
  31. Mar 02, 2009
  32. Feb 06, 2009
  33. Dec 19, 2008
    • Mark Michelson's avatar
      Get rid of an extra space. · e015e6f4
      Mark Michelson authored
      I don't know how this crept back in when I had already
      fixed it earlier
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166162 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      e015e6f4
    • Mark Michelson's avatar
      Adding a new dialplan function AUDIOHOOK_INHERIT · 9733b30f
      Mark Michelson authored
      This function is being added as a method to allow for
      an audiohook to move to a new channel during a channel
      masquerade. The most obvious use for such a facility is
      for MixMonitor when a transfer is performed. Prior to
      the addition of this functionality, if a channel 
      running MixMonitor was transferred by another party, then
      the recording would stop once the transfer had completed.
      By using AUDIOHOOK_INHERIT, you can make MixMonitor 
      continue recording the call even after the transfer
      has completed.
      
      It has also been determined that since this is seen
      by most as a bug fix and is not an invasive change,
      this functionality will also be backported to 1.4 and
      merged into the 1.6.0 branches, even though they are
      feature-frozen.
      
      (closes issue #13538)
      Reported by: mbit
      Patches:
            13538.patch uploaded by putnopvut (license 60)
      	  Tested by: putnopvut
      
      Review: http://reviewboard.digium.com/r/102/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      9733b30f
  34. Oct 14, 2008
  35. Aug 10, 2008
  36. Aug 05, 2008
  37. Jul 14, 2008
  38. Jul 11, 2008
Loading