curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Multipart POSTs with large bodies

From: Reese Grimsley via curl-library <curl-library_at_cool.haxx.se>
Date: Sun, 16 Apr 2017 11:55:29 -0500

Thanks, that helps quite a bit.

I think I will be using only the file parts of formadd (no callback) until
I have this program set up to collect audio in parallel.

On Sun, Apr 16, 2017 at 4:39 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Wed, 12 Apr 2017, Reese Grimsley wrote:
>
> Hopefully this helps clear up what I am trying to ask, here is an excerpt
>> of the documentation I am referring to: "This event should be sent to AVS
>> as a multipart message: the first part a JSON-formatted object, the second
>> part binary audio captured by the microphone. We encourage streaming
>> (chunking) captured audio to the Alexa Voice Service to reduce latency; the
>> stream should contain 10ms of captured audio per chunk (320 bytes)".
>>
>
> My interpretation of this is that they suggest chunking so that you can
> start sending this to them earlier. You don't have to wait until the entire
> recording is done so that you know the final file size, you can start
> earlier. That reduces the latency.
>
> Besides, it is only "encouraged" which doesn't sound like it is required
> or mandated.
>
> So if I wish to stream the audio as stated above, should I try to use
>> CURLFORM_STREAM with a callback function?
>>
>
> If you want to provide the data from a callback rather than from a file,
> yes.
>
> If I understand it right, I would need to setup a callback function, and
>> use the file to upload as the parameter for CURLFORM_STREAM and its name
>> for CURLFORM_FILENAME in formadd, as well as setup the CURLOPT_READFUNCTION
>> to use said callback.
>>
>
> Sounds about right, yes.
>
> Is the size of the buffer handled automatically by curl, or is there a way
>> to define it?
>>
>
> "the buffer" as in the memory area libcurl uses when copying data into
> that it then sends off to the server will use a sensible default and you
> don't need to change it. In fact, even if you want to change it I'd urge
> you to first get it working without changing it so that you know the basics
> first and *then* you can experiment with changing the buffer size with the
> CURLOPT_BUFFERSIZE option. I don't think you have a situation where
> adjusting the buffer size will give you much benefits.
>
> --
>
> / daniel.haxx.se
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-04-16