[flac-dev] About Decode Streaming

Burak Orçun Özkablan borcunozkablan at gmail.com
Mon Jul 1 09:13:49 PDT 2013


Sorry, I am newbie.

Sample codes are from
https://github.com/oneman/libflac/tree/master/examples/cpp.
I used FLAC__stream_decoder_process_single function but it still gives
exception. Maybe I could not control read callback, you're right.
I will check it and write result in this thread.

Thanks for help.


2013/7/1 Martijn van Beurden <mvanb1 at gmail.com>

>  I'll top-post this one because it wasn't sent to the mailinglist but to
> me. Please reply to list next time.
>
> 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.
>
> 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.
>
> Oh, and you might take a look at the reading callback, maybe that one is
> overreading the buffer?
>
> I hope that helps.
>
>
> On 01-07-13 17:51, Burak Orçun Özkablan wrote:
>
> Martijn,
>
>  I encode a one second captured audio data in my PC and send it to other
> PC as encoded. This is OK.
> I want to decode data in other PC and play it but when I am decoding data
> with decoder stream function, exception throws.
>
>
> 2013/7/1 Burak Orçun Özkablan <borcunozkablan at gmail.com>
>
>> 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).
>> Streaming which I used is audio data transfer over UDP or TCP sockets of
>> boost library.
>>
>>  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.
>> 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.
>>
>>  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.
>> 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.
>>
>>
>> 2013/7/1 Martijn van Beurden <mvanb1 at gmail.com>
>>
>>> On 01-07-13 16:48, Burak Orçun Özkablan wrote:
>>> > [...]
>>> >
>>> > I run your sample codes, encode.c and decode.c, about file encode /
>>> > decode. Then, I run
>>> > streaming encode / decode with two different source codes but when I
>>> > use streaming encode / decode over network in real-time, code throws
>>> > LOST_SYNC exception and only reading callback runs not writing
>>> > callback after exception.
>>>
>>>  I'm not sure I understand what you mean. You are talking about file
>>> encode and decode ans streaming encode and decode, do you mean the files
>>> in the FLAC source directory example? If so, what is the difference,
>>> because I only see file encoding examples?
>>>
>>> Furthermore, I wonder what you mean by stream. Are you serving a file
>>> that is being encoded over HTTP, S(a)MB(a), NFS or something specially
>>> designed for streaming, like MMS? So, how are you streaming the FLAC
>>> file?
>>>
>>> > How can I solve sync problem over network? Is it possible over network
>>> > or does FLAC stream with file?
>>>
>>>  FLAC is capable of streaming, so it should be possible to fix this I
>>> guess.
>>> _______________________________________________
>>> flac-dev mailing list
>>> flac-dev at xiph.org
>>> http://lists.xiph.org/mailman/listinfo/flac-dev
>>>
>>
>>
>>
>>   --
>>
>>
>>  Burak Orçun ÖZKABLAN
>>
>> Computer Science Engineer
>>
>>
>>  Mobile  : 0 541 302 18 78 <0%20541%20302%2018%2078>
>>
>>
>
>
>  --
>
>
>  Burak Orçun ÖZKABLAN
>
> Computer Science Engineer
>
>
>  Mobile  : 0 541 302 18 78
>
>
>
> _______________________________________________
> flac-dev mailing list
> flac-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/flac-dev
>
>


-- 


Burak Orçun ÖZKABLAN

Computer Science Engineer


Mobile  : 0 541 302 18 78
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20130701/b7a1e332/attachment.htm 


More information about the flac-dev mailing list