<div dir="ltr"><div><div><div><div><div><div><div><div><div>I've been thinking about my problem and it can be described as this:<br><br></div>1 - I have to decode audio, and send to the client.<br></div>2 - From the source audio that will be decoded i know the size and duration of the <span style class="">PCM</span> <span style class="">wav</span> file that will be generated.<br>
</div><div>3 - The length of the generated audio file is sent to the client.<br></div>3 - I want the client to be able to start playback as soon as possible, so i start sending the decoded audio ASAP (IPC is done using fdsink).<br>
</div>4 - On the end of the stream <span style class="">wavenc</span> tries to write the duration of the <span style class="">wav</span> file on the header, but it has already been sent and the file descriptor is not seekable.<br>
<br></div><div><br></div>It seems to me that what i really want is a way to tell the <span style class="">wavenc</span> <span style class="">plugin</span> the duration of the <span style class="">wav</span> file on the start of the streaming, disabling this behaviour of seeking back and writing the duration on the <span style class="">EOS</span>.<br>
<br></div>The client that i am providing the audio is the HTML5 audio tag (HTTP Streaming), and even with the wrong duration on the <span style class="">wav</span> header it is working perfectly (i assume it uses the content-length provided on the response and ignores the duration information on the <span style class="">wav</span> header), but making some changes on <span style class="">wavenc</span> would make possible to send correct header information (in the future i may have problems with that) and would prevent the errors on <span style class="">fdsink</span>.<br>
<br></div>Any of this makes sense ?<br><br></div>Best regards,<br></div><span style class="">Tiago</span> <span style class="">Katcipis</span><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 14, 2014 at 3:04 PM, Tiago Katcipis <span dir="ltr"><<a href="mailto:katcipis@inf.ufsc.br" target="_blank">katcipis@inf.ufsc.br</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I have the following pipeline:<br><br><span>giosrc</span> location=my_remote_location ! <span>wavparse</span> ! <span>adpcmdec</span> ! <span>audioconvert</span> ! <span>audioresample</span> ! audio/x-raw,rate=8000,channels=1,format=S16LE ! <span>wavenc</span> ! <span>fdsink</span><br>

<br></div>I use the <span>stdout</span> of the process that runs this pipeline to stream the <span>PCM</span> audio to the client. But on the end of the streaming i always get the error:<br><div>
<div><br>ERROR: element fdsink0: detail: Could not perform seek on resource.<br>Debugging info: <span>gstfdsink</span>.c(602): <span>gst</span>_<span>fd</span>_sink_event (): /<span>GstPipeline</span>:pipeline0/<span>GstFdSink</span>:fdsink0:<br>

Error while seeking on file descriptor 1: Illegal seek<br><br></div><div>Taking a look at debug info:<br><br>0:00:<a href="tel:18.295838530" value="+18295838530" target="_blank">18.295838530</a>  2112  0x9ee1fb0 DEBUG                 <span>wavenc</span> <span>gstwavenc</span>.c:230:<span>gst</span>_<span>wavenc</span>_push_header:<wavenc0> writing header with <span>datasize</span>=2017980<br>

0:00:<a href="tel:18.295857946" value="+18295857946" target="_blank">18.295857946</a>  2112  0x9ee1fb0 DEBUG                 <span>fdsink</span> <span>gstfdsink</span>.c:552:<span>gst</span>_<span>fd</span>_sink_do_seek:<fdsink0> File descriptor 1 failed to seek to position 0<br>

0:00:<a href="tel:18.295883299" value="+18295883299" target="_blank">18.295883299</a>  2112  0x9ee1fb0 WARN                  <span>fdsink</span> <span>gstfdsink</span>.c:602:<span>gst</span>_<span>fd</span>_sink_event:<fdsink0> error: Error while seeking on file descriptor 1: Illegal seek<br>

ERROR: element fdsink0: detail: Could not perform seek on resource.<br>0:00:<a href="tel:18.295918848" value="+18295918848" target="_blank">18.295918848</a>  2112  0x9ee1fb0 WARN                  <span>wavenc</span> <span>gstwavenc</span>.c:239:<span>gst</span>_<span>wavenc</span>_push_header:<wavenc0> push header failed: flow <br>

</div><div><br></div><div>It seems to me that <span>wavenc</span> is trying to seek to the beginning of the file to write the <span>wav</span> header, but the <span>stdout</span> file descriptor is not <span>seekable</span>, the data has already been sent (and the wrong header is not a problem to me on this case).<br>

<br></div><div>Shouldn't <span>fdsink</span> handle non <span>seekable</span> file descriptors gracefully ? Something like refusing to handle the seek event if it is not <span>seekable</span> ? It seems quite drastic to give an error on the pipeline.<br>

<br></div><div>Best regards,<br></div><div>Tiago Katcipis<br></div></div></div>
</blockquote></div><br></div>