title: Android - Include native StageFright features in my own project
body: <p>I am currently developing an application that needs to record audio, encode it as AAC, stream it, and do the same in reverse - receiving stream, decoding AAC and playing audio.</p>
  
  <p>I successfully recorded AAC (wrapped in a MP4 container) using the <a href="http://developer.android.com/reference/android/media/MediaRecorder.html">MediaRecorder</a>, and successfully up-streamed audio using the <a href="http://developer.android.com/reference/android/media/AudioRecord.html">AudioRecord</a> class. But, I need to be able to encode the audio as I stream it, but none of these classes seem to help me do that.</p>
  
  <p>I researched a bit, and found that most people that have this problem end up using a native library like <strong>ffmpeg</strong>.</p>
  
  <p>But I was wondering, since Android already includes <strong>StageFright</strong>, that has native code that can do encoding and decoding (for example, <a href="https://github.com/android/platform_frameworks_base/blob/master/media/libstagefright/include/AACEncoder.h">AAC encoding</a> and <a href="https://github.com/android/platform_frameworks_base/blob/master/media/libstagefright/include/AACDecoder.h">AAC decoding</a>), is there a way to use this native code on my application? How can I do that?</p>
  
  <p>It would be great if I only needed to implement some JNI classes with their native code. Plus, since it is an Android library, it would be no licensing problems whatever (correct me if I'm wrong).</p>