[vlc-devel] [PATCH 1/2] DASH: fix Read() function

Frederic YHUEL fyhuel at viotech.net
Thu Mar 22 10:25:27 CET 2012


2012/3/15  <fyhuel at viotech.net>:
> From: Frédéric Yhuel <fyhuel at viotech.net>
>
> Currently, Read() might returns less than i_len bytes, while not at the
> end of the stream. This is wrong and the patch fix that.
> ---
>  modules/stream_filter/dash/dash.cpp |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
> index d1ca988..98123c0 100644
> --- a/modules/stream_filter/dash/dash.cpp
> +++ b/modules/stream_filter/dash/dash.cpp
> @@ -165,10 +165,20 @@ static int  Read            (stream_t *p_stream, void *p_buffer, unsigned int i_
>     stream_sys_t        *p_sys          = (stream_sys_t *) p_stream->p_sys;
>     dash::DASHManager   *p_dashManager  = p_sys->p_dashManager;
>     int                 i_ret           = 0;
> +    int                 i_read          = 0;
>
> -    i_ret = p_dashManager->read(p_buffer, i_len );
> +    while( i_len > 0 )
> +    {
> +        i_read = p_dashManager->read( p_buffer, i_len );
> +        if( i_read < 0 )
> +            break;
> +        p_buffer += i_read;
> +        i_ret += i_read;
> +        i_len -= i_read;
> +    }
> +    p_buffer -= i_ret;
>
> -    if (i_ret < 0)
> +    if (i_read < 0)
>     {
>         switch (errno)
>         {
> --
> 1.7.5.4
>

ping?

-- 
Frédéric



More information about the vlc-devel mailing list