[vlc-devel] [PATCH] demux: adaptive: workaround successive setPosition failed by flush EsOutAddCommand

Zhao Zhili quinkblack at foxmail.com
Thu Oct 12 13:11:02 CEST 2017


Hi all,

Ping for review.

> On 7 Oct 2017, at 2:03 PM, Zhao Zhili <quinkblack at foxmail.com> wrote:
> 
> ---
> modules/demux/adaptive/Streams.cpp                |  8 ++++++
> modules/demux/adaptive/plumbing/CommandsQueue.cpp | 33 +++++++++++++++++++++++
> modules/demux/adaptive/plumbing/CommandsQueue.hpp |  1 +
> 3 files changed, 42 insertions(+)
> 
> diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
> index 96543d3187..d1e97df358 100644
> --- a/modules/demux/adaptive/Streams.cpp
> +++ b/modules/demux/adaptive/Streams.cpp
> @@ -498,7 +498,15 @@ bool AbstractStream::setPosition(mtime_t time, bool tryonly)
>             setTimeOffset(segmentTracker->getPlaybackTime());
> 
>             if( !restartDemux() )
> +            {
>                 dead = true;
> +            }
> +            else
> +            {
> +                /* To avoid a successive setPosition failed because fakeesout is restarting, we
> +                 * flush EsOutAddCommand here. */
> +                commandsqueue->flushAddCommand(p_realdemux->out);
> +            }
>         }
>         else commandsqueue->Abort( true );
> 
> diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.cpp b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
> index f2a48b6cec..7d7c81b408 100644
> --- a/modules/demux/adaptive/plumbing/CommandsQueue.cpp
> +++ b/modules/demux/adaptive/plumbing/CommandsQueue.cpp
> @@ -417,6 +417,39 @@ bool CommandsQueue::isEOF() const
>     return b;
> }
> 
> +void CommandsQueue::flushAddCommand( es_out_t *out )
> +{
> +    std::list<AbstractCommand *>::iterator it;
> +
> +    it = commands.begin();
> +    while( it != commands.end() )
> +    {
> +        if( (*it)->getType() == ES_OUT_PRIVATE_COMMAND_ADD )
> +        {
> +            (*it)->Execute(out);
> +            it = commands.erase(it);
> +        }
> +        else
> +        {
> +            ++it;
> +        }
> +    }
> +
> +    it = incoming.begin();
> +    while( it != incoming.end() )
> +    {
> +        if( (*it)->getType() == ES_OUT_PRIVATE_COMMAND_ADD )
> +        {
> +            (*it)->Execute(out);
> +            it = incoming.erase(it);
> +        }
> +        else
> +        {
> +            ++it;
> +        }
> +    }
> +}
> +
> mtime_t CommandsQueue::getDemuxedAmount() const
> {
>     return bufferinglevel - getFirstDTS();
> diff --git a/modules/demux/adaptive/plumbing/CommandsQueue.hpp b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
> index 979820e66a..7d0df386b2 100644
> --- a/modules/demux/adaptive/plumbing/CommandsQueue.hpp
> +++ b/modules/demux/adaptive/plumbing/CommandsQueue.hpp
> @@ -163,6 +163,7 @@ namespace adaptive
>             void setEOF();
>             bool isDraining() const;
>             bool isEOF() const;
> +            void flushAddCommand( es_out_t *out );
>             mtime_t getDemuxedAmount() const;
>             mtime_t getBufferingLevel() const;
>             mtime_t getFirstDTS() const;
> -- 
> 2.13.2
> <0001-demux-adaptive-workaround-successive-setPosition-fai.patch>





More information about the vlc-devel mailing list