<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 8/28/16 12:50 AM, Paul B Mahol
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAPYw7P6jP5_HciR28oRfV7ciR_1Wb2QYZ1kJpsRs7B=ZGNBU=g@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi,<br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Sun, Aug 28, 2016 at 7:16 AM,
            Christopher Snowhill <span dir="ltr"><<a
                moz-do-not-send="true" href="mailto:kode54@gmail.com"
                target="_blank">kode54@gmail.com</a>></span> wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">I've
              noticed that when using these libraries in my own
              projects, at<br>
              least in VGMStream, and with the WMA Pro codec, it is
              necessary to<br>
              perform my own pre-roll when seeking for looping, or else
              the codec<br>
              ramps the audio in from silence on every loop as it
              catches back up to a<br>
              valid state. I currently use either two seconds, or the
              beginning of the<br>
              file if it's less than two seconds prior to the intended
              seek point,<br>
              then discard sample data that is returned by the decoder.<br>
              <br>
              Is this always necessary by design? Or am I misusing the
              seeking API?<br>
              <br>
              I currently use:<br>
              <br>
              int64_t ts = target_sample * formatCtx->duration /
              total_samples;<br>
              avformat_seek_file(formatCtx, -1, ts - 1000, ts, ts,
              AVSEEK_FLAG_ANY);<br>
            </blockquote>
            <div><br>
            </div>
            <div>Do you call avcodec_flush_buffers()? <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    Yes, I do. Immediately after avformat_seek_file.<br>
    <blockquote
cite="mid:CAPYw7P6jP5_HciR28oRfV7ciR_1Wb2QYZ1kJpsRs7B=ZGNBU=g@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra"><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>