[vlc-devel] [vlc-commits] demux: adaptive: use custom status for http queries

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 15 07:56:10 CEST 2018


On 12/10/2018 17:15, Francois Cartegnie wrote:
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 12 11:03:43 2018 +0200| [4c2ba7cceda69d4e2a558906dec030bcf5167001] | committer: Francois Cartegnie
>
> demux: adaptive: use custom status for http queries
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4c2ba7cceda69d4e2a558906dec030bcf5167001
> ---
>
>   modules/demux/adaptive/http/Chunk.cpp            |  7 +++--
>   modules/demux/adaptive/http/ConnectionParams.hpp |  9 ++++++
>   modules/demux/adaptive/http/HTTPConnection.cpp   | 39 +++++++++++++-----------
>   modules/demux/adaptive/http/HTTPConnection.hpp   | 11 ++++---
>   4 files changed, 41 insertions(+), 25 deletions(-)
>
> diff --git a/modules/demux/adaptive/http/Chunk.cpp b/modules/demux/adaptive/http/Chunk.cpp
> index eb0532b6a0..0674231ee5 100644
> --- a/modules/demux/adaptive/http/Chunk.cpp
> +++ b/modules/demux/adaptive/http/Chunk.cpp
> @@ -250,10 +250,11 @@ bool HTTPChunkSource::prepare()
>                   break;
>           }
>   
> -        int i_ret = connection->request(connparams.getPath(), bytesRange);
> -        if(i_ret != VLC_SUCCESS)
> +        enum RequestStatus status =
> +                connection->request(connparams.getPath(), bytesRange);
> +        if(status != RequestStatus::Success)
>           {
> -            if(i_ret == VLC_ETIMEOUT) /* redirection */
> +            if(status == RequestStatus::Redirection)
>               {
>                   HTTPConnection *httpconn = dynamic_cast<HTTPConnection *>(connection);
>                   if(httpconn)
> diff --git a/modules/demux/adaptive/http/ConnectionParams.hpp b/modules/demux/adaptive/http/ConnectionParams.hpp
> index e8cf5cec7c..5730ba9c63 100644
> --- a/modules/demux/adaptive/http/ConnectionParams.hpp
> +++ b/modules/demux/adaptive/http/ConnectionParams.hpp
> @@ -29,6 +29,15 @@ namespace adaptive
>       {
>           class Transport;
>   
> +        enum RequestStatus
> +        {
> +            Success,
> +            Redirection,
> +            Unauthorized,
> +            NotFound,
> +            GenericError,

Might be a good idea to set them to the corresponding HTTP status code 
when possible.


More information about the vlc-devel mailing list