Frage

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() );
}
War es hilfreich?

Lösung

Your question is about code from the videolan project. The code you pasted is on the videolan web server.

The videolan developers page says they have an IRC channel (irc://irc.videolan.org/videolan) and mailing lists where you can ask questions.

I recommend you do some more reading of the code in the DASH stream_filter module, especially the buffer directory (which calculates the buffered percent you're asking about) and then ask a specific question on IRC or the mailing list.

Unfortunately, this code doesn't seem to have comments or documentation. If the normal channels aren't helpful, you can ask the authors. They were kind enough to include email addresses in the copyright notice at the top of the file.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top