History log of /haiku/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp
Revision Date Author Comments
# 78b14420 24-Jul-2020 Leorize <leorize+oss@disroot.org>

libbnetapi: BUrlRequest now outputs to BDataIO

Previously, BUrlRequest returns data received via a callback that can't
return any value. This approach have several issues:

- It's not possible to signify failures to the request.
- Users have to implement custom listeners just to handle the common
case of outputting to a buffer/file/etc.
- The received data has to be serialized into BMessage when
BUrlProtocolDispatchingListener is employed. This can cause a
noticible slowdown in real-world scenarios as evident by #10748.

With this change, BUrlRequest will output directly into a BDataIO, which
exposes a richer API for request handlers to work with (for example a
BitTorrent client can request a BPositionIO for non-linear data
delivery), as well as simplifying common cases for users.

The adaptation only requires one additional API:
BHttpRequest::SetStopOnError(). This API simply instructs the HTTP
request handler to cancel the request if an HTTP error is occurred.

Change-Id: I4160884d77bff0e7678e0a623e2587987704443a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3084
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 3e27f8d5 17-Jul-2020 Leorize <leorize+oss@disroot.org>

libbnetservices: BUrlResult is no longer a BArchivable

The switch to make BUrlResult serializable was debuted in
f9e1854f198d4200f21a9cbe29fdfb0fabbe192f with the rationale is that
BHttpRequest auto-redirection might cause the headers to become
obsolete by the time a client process the BMessage received from
BUrlProtocolDispatchingListener.

With the change to BHttpRequest to not notify listeners when
auto-redirection is enabled, this is no longer the case and the
serialization code can go away now. This simplifies BUrlResult and its
subclasses, and gain us some performance for clients using
BUrlProtocolDispatchingListener as the result object no longer has to be
serialized.

This also change the ABI of BUrlProtocolListener::HeadersReceived to no
longer passing a BUrlResult.

Additionally, BUrlResult and BHttpResult now express the size of the content
as an off_t, thus allowing results larger than 4 GB.

Change-Id: I9dd29a8b26fdd9aa8e5bbad8d1728084f136312d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3082
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ac4b8373 22-Jan-2021 Niels Sascha Reedijk <niels.reedijk@gmail.com>

http_streamer: switch to libnetservices.a

Switch to the experimental services API as the copy in libbnetapi.so is
deprecated.

Change-Id: I57d76b1d1be5c957221cc2d77d148fadbac2a642
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3668
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# f8fdf848 17-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

HTTPStreamer: Another build fix I forgot to commit.

Sorry for the noise...


# 218a8c03 17-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

Revert the Codec Kit.

All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.

Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0


# 5232a911 27-Nov-2018 Barrett17 <b.vitruvio@gmail.com>

media_plugins: Rework to use the BCodecKit namespace


# 8f99629d 24-Oct-2018 Barrett17 <b.vitruvio@gmail.com>

http_streamer: Use MediaDebug.h


# ff5c2dc2 28-Jun-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

FileListener: does not need to be asynchronous.

The asynchronous listener is meant to be used when the functions are
meant to be called from the main thread (or another looper the listener
is explicitly atached to).

For this to work, the request should be attached to
listener->SynchronousListener(), which was not the case here. Assume it
is fine for the functions to be called from the HTTP thread directly
then (if I'm wrong, revert this and attach the synchronous listener to
the http request, however wihout further changes it will just move the
execution of the callbacks to the main thread, which may not be the
right place either).

This fixes a crash when exiting WebKit while playing a youtube video
(somehow the handler isn't cleanly deleted and removed from the main
looper there - going without a handler at all fixes this).


# 76c469db 30-Jan-2017 Adrien Destugues <pulkomandy@gmail.com>

Fix some users of the HTTP API I missed in the previous commit.


# af7d48fe 31-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

style fix.


# b2fa4e17 31-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

HTTP media IO: fix another case of crash.


# 98e33bf6 31-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

HTTPMediaIO: fix crash on exit.

- Remove custom BUrlContext, use the shared one to simplify ownership
management. This means all HTTP media streams in an application share
the same context (including cookies), however.
- Fix deletion of the BUrlRequest object, which cannot reliably happen
before the thread has exited. RequestCompleted is too early.


# a5b5f896 30-Oct-2016 Adrien Destugues <pulkomandy@pulkomandy.tk>

http_streamer: don't access headers before HeadersReceived.

UpdateSize uses HttpResult::Length, which relies on the
contetn-length header to be already received from the server. Doing it
in ConnectionOpened will not work. Doing it from HeadersReceived, which
is called a bit later, will work.

This allows using the http_streamer in webkit for youtube video playing,
and should fix all uses with a fixed size resource (rather than an
endless stream).


# e42135e5 22-Oct-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: improve IsRunning() safeness


# 3ff901ac 07-Sep-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Fix different issues

* Cleanup object management.
* Remove Close() and use the destructor in place.
* Release listener sem on exit.
* Return when there's a request mismatch.
* Add some debugging.
* MediaPlayer crashes are fixed as result of the patchset.


# 4e793ddd 21-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Don't always use listener's IsRunning

* We are not really handling http requests only.
* Also move BHttpResult retrieve after casting BUrlRequest.


# b4515980 21-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Handle http status codes

* Avoid to stop the next request after redirection.
* Fixes #12854.


# be2c0725 10-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Enforce safeness in constructor/thread

* Wait for the thread to exit.
* Update size from the data thread.


# eed8ce57 09-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Implement IsRunning, more reliability

* The init sem is released also when the request is completed
to be sure the backend doesn't lock on us.
* Implement IsRunning relying on BUrlRequest::IsRunning.


# 5c05bb48 08-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

AdapterIO: Remove default arguments in ctor


# b4e751b8 03-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Mutable flag is chosen at runtime

* BeOS Radio now works.


# d3630cba 02-Jul-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Refine init, set static timeout

* When in Open() the plugin wait for the first buffer
or return an error if timeout expires.
* Make size retrieve more reliable.


# 1acb1f50 30-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

Style fixes


# 93a1f9d2 30-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Sync with BAdapterIO changes


# 241a3292 25-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Handle Run() failed


# 7f28cdba 24-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Check request after creation

* Thanks to DeadYak for the help.


# 0ba82236 24-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

Streaming: Remove any pointer BUrl argument

* There's no need to pass BUrl by pointer, this is
potentially dangerous and leaky without any advantage,
copying is definitely safer.


# 40dca224 22-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Style fixes and cleanup


# f1c771f8 22-Jun-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

HTTPMediaIO: Implement SetSize and GetSize

* SetSize requests are denied where GetSize return the request
lengths. Note that flags are changed accordingly.


# fbabc74d 30-May-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: General refactor making use of new API

* Use BUrlProtocolRoster instead of BFileRequest.
* Removed HTTPMediaIO custom code that now inherits
BAdapterIO and make the whole thing more simple.
* It work with some formats (flv, mp3, mkv) but ffmpeg fail
on others (mp4, 3gp).
* GetSize needs improvements.


# 617b62c9 17-Mar-2016 Dario Casalinuovo <b.vitruvio@gmail.com>

http_streamer: Add basic draft version