bufferedPercent如何工作

问题描述 投票:0回答:1

2个问题:

1-我试图理解基于速率的自适应逻辑代码(完整的cpp代码在底部),我不太明白getBufferedPercent函数返回什么。

2-有没有我可以找到关于这种功能的适当文件?

这里是RateBasedAdaptationLogic.cpp代码:

    #ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "RateBasedAdaptationLogic.h"

using namespace dash::logic;
using namespace dash::xml;
using namespace dash::http;
using namespace dash::mpd;

RateBasedAdaptationLogic::RateBasedAdaptationLogic  (IMPDManager *mpdManager, stream_t *stream) :
                          AbstractAdaptationLogic   (mpdManager, stream),
                          mpdManager                (mpdManager),
                          count                     (0),
                          currentPeriod             (mpdManager->getFirstPeriod()),
                          width                     (0),
                          height                    (0)
{
    this->width  = var_InheritInteger(stream, "dash-prefwidth");
    this->height = var_InheritInteger(stream, "dash-prefheight");
}

Chunk*  RateBasedAdaptationLogic::getNextChunk()
{
    if(this->mpdManager == NULL)
        return NULL;

    if(this->currentPeriod == NULL)
        return NULL;

    uint64_t bitrate = this->getBpsAvg();

    if(this->getBufferPercent() < MINBUFFER)
        bitrate = 0;

    Representation *rep = this->mpdManager->getRepresentation(this->currentPeriod, bitrate, this->width, this->height);

    if ( rep == NULL )
        return NULL;

    std::vector<Segment *> segments = this->mpdManager->getSegments(rep);

    if ( this->count == segments.size() )
    {
        this->currentPeriod = this->mpdManager->getNextPeriod(this->currentPeriod);
        this->count = 0;
        return this->getNextChunk();
    }

    if ( segments.size() > this->count )
    {
        Segment *seg = segments.at( this->count );
        Chunk *chunk = seg->toChunk();
        //In case of UrlTemplate, we must stay on the same segment.
        if ( seg->isSingleShot() == true )
            this->count++;
        seg->done();
        chunk->setCalculatedBW(this->getBpsAvg());
        return chunk;
    }
    return NULL;
}

const Representation *RateBasedAdaptationLogic::getCurrentRepresentation() const
{
    return this->mpdManager->getRepresentation( this->currentPeriod, this->getBpsAvg() );
}
c++ video-streaming network-protocols mpeg-dash
1个回答
1
投票

您的问题是关于videolan项目的代码。你粘贴的代码是on the videolan web server

The videolan developers page说他们有一个IRC频道(irc://irc.videolan.org/videolan)和mailing lists,你可以在那里提问。

我建议你多阅读一下DASH stream_filter module中的代码,特别是缓冲目录(计算你要问的缓冲百分比),然后在IRC或邮件列表上询问一个特定的问题。

不幸的是,这段代码似乎没有评论或文档。如果正常渠道没有帮助,您可以询问作者。他们非常友好地在文件顶部的版权声明中包含电子邮件地址。

© www.soinside.com 2019 - 2024. All rights reserved.