title: How are audio frames decoded by libavcodec?
body: <p>Here is how my process of decoding an audio stream  using ffmpeg's libav*</p>
  
  <blockquote>
    <p>[videofile]--> (read audio packets) --> [pkts queue] --> (decoder) -->
    speaker's sample buffer</p>
  </blockquote>
  
  <p>for some reason i need to insert a buffer after decoder</p>
  
  <blockquote>
    <p>[videofile]--> (read audio packets) --> [pkts queue] --> (decoder) -->
    [samples buffer] --> speaker's sample buffer</p>
  </blockquote>
  
  <p>Audio samples in the <code>samples buffer</code> are LPCM 16bits. To save the pts of the audio <code>sample buffer</code> i save pts of first samples. By that way, i can calculate pts of any sample in the buffer.</p>
  
  <p>Problem is that the calculation is correct only if the audio stream contains contiguous audio samples. Do ffmpeg's decoded audio frames always contain contiguous samples?</p>