cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi interface and RTSP interleved

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 13 Sep 2016 08:57:19 +0200 (CEST)

On Mon, 12 Sep 2016, Pawe³ Kopalko wrote:

> I'm using curl with RTSP/RTP streams, until now I've used easy_perform,
> which worked ok for me, but since I had to move to several threads there are
> complications, and thus I need to use multi interface since I understand
> that it will help me to regain some control. But the problem is I cannot get
> it to work for me,

What libcurl version are you using on what platform? The easy interface is
only a wrapper around the multi interface so internally they're both working
the exact same way.

> curl_multi_remove_handle(multi_handle, rtsp_handle);
> curl_easy_setopt(rtsp_handle, CURLOPT_RTSP_REQUEST,
> (long)CURL_RTSPREQ_RECEIVE);
> curl_multi_remove_handle(multi_handle, rtsp_handle);

You remove the same easy handle twice? And you set an option in between which
looks really strange? And your removal also assumes that you only ever have
that single handle added, which may be correct but keep that in mind if you
add more parallel handles to the transfer - normally you'd extract the
completed handle from the message as well.

> All the examples showed that multi_info_read should be after do {} while()
> but that kind of doesn't appeal to me (maybe that what is wrong),

It's of course up to you how you loop. There are basically two hints you can
get: the counter from curl_multi_perform() and the message from
curl_multi_info_read(). You can use either or both as a signal when the
transfer has ended.

> I would like to ask for help understanding what I'm doing wrong.

You didn't elaborate on what the differences in beaviors are between your
easy-using app and your multi-version so it's not easy for anyone to guess.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-13