<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">I'll top-post this one because it
      wasn't sent to the mailinglist but to me. Please reply to list
      next time.<br>
      <br>
      I assume you mean the main.c files in the encode and decode
      directory under examples. I can't really determine the root cause
      of your problem with this information, but I think you're trying
      to feed the decoder blocks that are incomplete. The LOST SYNC
      error is usually seen with corrupted blocks, so I think the blocks
      are incomplete or, less likely, corrupt.<br>
      <br>
      There are a few ways to counter this. The easy way is to add a
      little latency to be sure at least one complete block is in the
      receiving buffer. So, only call
      FLAC__stream_decoder_process_single() if the buffer is filled with
      enough data. If you want the lowest latency possible you could
      force a small block size or let the encoding PC signal the
      decoding PC when a block is finished, so the decoding process can
      be sure there is a full block in the buffer.<br>
      <br>
      Oh, and you might take a look at the reading callback, maybe that
      one is overreading the buffer?<br>
      <br>
      I hope that helps.<br>
      <br>
      On 01-07-13 17:51, Burak Orçun Özkablan wrote:<br>
    </div>
    <blockquote
cite="mid:CAG=9prtB+wA89zZDCGmJ-U=xCRK9kvsqcndGGL=24gfb3Qzn1A@mail.gmail.com"
      type="cite">
      <div dir="ltr">Martijn,
        <div><br>
        </div>
        <div style="">I encode a one second captured audio data in my PC
          and send it to other PC as encoded. This is OK.</div>
        <div style="">I want to decode data in other PC and play it but
          when I am decoding data with decoder stream function,
          exception throws.</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/7/1 Burak Orçun Özkablan <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:borcunozkablan@gmail.com" target="_blank">borcunozkablan@gmail.com</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Yes, I mean sample codes in FLAC directory.
              These samples (encode.c and decode.c) are about
              encode/decode with file (using
              FLAC__stream_encoder_init_file and
              FLAC__stream_decoder_init_file functions).
              <div>
                Streaming which I used is audio data transfer over UDP
                or TCP sockets of boost library. </div>
              <div><br>
              </div>
              <div>I send 1 packet which contains 1 second "raw" audio
                data and header information as unsigned char array. In
                the other PC, I play it. I must do it continuously, so I
                said 'streaming' for this.</div>
              <div>I can stream without FLAC library but I have to do
                with any codec library because our network bandwidth is
                low so I dont want overhead problem and latency.</div>
              <div><br>
              </div>
              <div>For streaming, FLAC suggests streaming functions such
                as FLAC__stream_encoder_init_stream,
                FLAC__stream_decoder_init_stream. The decoder stream
                function takes 3 callback functions, write, read and
                error.</div>
              <div>What I understand from LOST SYNC exception is write
                and read callback must runs sync. I can not success it,
                code runs only reading callbacks and throws LOST_SYNC
                exception.</div>
            </div>
            <div class="gmail_extra">
              <div>
                <div class="h5">
                  <br>
                  <br>
                  <div class="gmail_quote">2013/7/1 Martijn van Beurden
                    <span dir="ltr">&lt;<a moz-do-not-send="true"
                        href="mailto:mvanb1@gmail.com" target="_blank">mvanb1@gmail.com</a>&gt;</span><br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      On 01-07-13 16:48, Burak Orçun Özkablan wrote:<br>
                      &gt; [...]<br>
                      <div>&gt;<br>
                        &gt; I run your sample codes, encode.c and
                        decode.c, about file encode /<br>
                        &gt; decode. Then, I run<br>
                        &gt; streaming encode / decode with two
                        different source codes but when I<br>
                        &gt; use streaming encode / decode over network
                        in real-time, code throws<br>
                        &gt; LOST_SYNC exception and only reading
                        callback runs not writing<br>
                        &gt; callback after exception.<br>
                        <br>
                      </div>
                      I'm not sure I understand what you mean. You are
                      talking about file<br>
                      encode and decode ans streaming encode and decode,
                      do you mean the files<br>
                      in the FLAC source directory example? If so, what
                      is the difference,<br>
                      because I only see file encoding examples?<br>
                      <br>
                      Furthermore, I wonder what you mean by stream. Are
                      you serving a file<br>
                      that is being encoded over HTTP, S(a)MB(a), NFS or
                      something specially<br>
                      designed for streaming, like MMS? So, how are you
                      streaming the FLAC file?<br>
                      <div><br>
                        &gt; How can I solve sync problem over network?
                        Is it possible over network<br>
                        &gt; or does FLAC stream with file?<br>
                        <br>
                      </div>
                      FLAC is capable of streaming, so it should be
                      possible to fix this I guess.<br>
                      _______________________________________________<br>
                      flac-dev mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:flac-dev@xiph.org" target="_blank">flac-dev@xiph.org</a><br>
                      <a moz-do-not-send="true"
                        href="http://lists.xiph.org/mailman/listinfo/flac-dev"
                        target="_blank">http://lists.xiph.org/mailman/listinfo/flac-dev</a><br>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                </div>
              </div>
              <div class="im">-- <br>
                <div dir="ltr">
                  <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                    <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
                    </blockquote>
                    <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Burak
                      Orçun ÖZKABLAN</blockquote>
                    <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Computer
                      Science Engineer</blockquote>
                    <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
                    </blockquote>
                    <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Mobile
                       : <a moz-do-not-send="true"
                        href="tel:0%20541%20302%2018%2078"
                        value="+905413021878" target="_blank">0 541 302
                        18 78</a></blockquote>
                  </blockquote>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr">
          <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
            <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
            </blockquote>
            <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Burak
              Orçun ÖZKABLAN</blockquote>
            <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Computer
              Science Engineer</blockquote>
            <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
            </blockquote>
            <blockquote
style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Mobile
               : 0 541 302 18 78</blockquote>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>