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() );
}
Ваш вопрос касается кода из проекта видеолента. Код, который вы вставили, находится на веб-сервере видеолента.
На странице разработчиков видеоканалов говорится, что у них есть канал IRC (irc://irc.videolan.org/videolan) и списки рассылки, где вы можете задавать вопросы.
Я рекомендую вам еще некоторое чтение кода в модуле DASH stream_filter, особенно в каталоге буфера (который вычисляет буферный процент, о котором вы спрашиваете), а затем задайте конкретный вопрос в IRC или списке рассылки.
К сожалению, этот код, похоже, не содержит комментариев или документации. Если обычные каналы не помогают, вы можете попросить авторов. Они были достаточно любезны, чтобы включить адреса электронной почты в уведомление об авторских правах в верхней части файла.