Re: How to receive mp3 stream in UPNP media renderer using libsoup?



On 08/07/2016 11:25 AM, progmars wrote:
I have already implemented simple HTTP Soup client using
soup_session_queue_message but I'm confused in which cases I should use
soup_session_send_async instead and how to abort connection right after
receiving HTTP headers and then how to proceed receiving mp3 data in
background.

soup_session_queue_message() and soup_session_send_async() are just
different ways of doing the same thing. soup_session_queue_message() is
simpler to use in the case where you want to request a resource and then
process it all at once after the whole response has been received.
soup_session_send_async() is simpler to use in the case where you want
to handle the response a little bit at a time as it's being received. So
it sounds like you want the latter.

I have been reading libsoup documentation and while it has some useful
code pieces, it doesn't give answers about use cases - which approach
should be used when, and how to achieve non-blocking but grained control
over the process without using explicit multithreading (which seems to
be discouraged in the libsoup documentation and I also would like to
avoid it, if possible).

The docs aren't meant to be "discouraging" multi-threading; you just
need to understand what operations are and aren't thread-safe (in
particular, it's ok to send multiple requests from multiple threads, but
you mostly can't work with a single request from two threads at the same
time).

-- Dan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]