0

2 questions:

1- Im trying to understand the Rate Based Adaptation Logic code (the complete cpp code is at the bottom), and I can't quite understand what getBufferedPercent function returns.

2- Is there place I can find proper documentations about this kind of functions?

here's RateBasedAdaptationLogic.cpp code:

    #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() );
}
4

1 回答 1

1

您的问题是关于 videolan 项目的代码。您粘贴的代码位于 videolan 网络服务器上

videolan 开发者页面说他们有一个 IRC 频道 (irc://irc.videolan.org/videolan) 和邮件列表,您可以在其中提问。

我建议您多阅读DASH stream_filter 模块中的代码,尤其是缓冲区目录(它计算您要询问的缓冲百分比),然后在 IRC 或邮件列表上提出特定问题。

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

于 2013-11-25T06:31:12.823 回答