bufferedPercent是如何工作的
how does bufferedPercent work
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() );
}
您的问题是关于videolan项目的代码。你粘贴的代码在videolan网络服务器上。
videolan开发者页面上说他们有一个IRC频道(irc://irc.videolan.org/videolan)以及邮件列表,您可以在其中提问。
我建议您更多地阅读DASH stream_filter模块中的代码,尤其是缓冲区目录(它计算您询问的缓冲百分比),然后在IRC或邮件列表中询问特定问题。
不幸的是,这段代码似乎没有注释或文档。如果正常渠道没有帮助,你可以问作者。他们很友善,在文件顶部的版权声明中包含了电子邮件地址。
相关文章:
- QSqlquery prepare()和bindvalue()不工作
- 导入库可以跨dll版本工作吗
- 以螺旋方式打印矩阵的程序.(工作不好)
- 对象指针在c++中是如何工作的
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- VSOMEIP-2个设备之间的通信(TCP/UDP)不工作
- 为字符串中每 N 个字符插入空格的函数没有按照我认为的方式工作?
- C++为线程工作动态地分割例程
- 为什么我的 std::ref 无法按预期工作?
- 布尔比较运算符是如何在C++中工作的
- SampleConsensusPrerejective(ext.RANSAC)是如何真正工作的
- 不确定要在我的main中放入什么才能使我的代码正常工作
- 为什么std::condition_variable notify_all的工作速度比notify_one快(对于随机请
- <<操作员在下面的行中工作
- 有人能解释一下为什么下界是这样工作的吗C++的
- ExtractIconEx:可以工作,但偶尔会崩溃
- C++中的memset函数工作不正常
- 当我在第一个循环中使用"auto"时,它工作正常,但是使用"int"它会给出错误,为什么?
- 当 int 方法工作正常时,void 方法有何不同,或者为什么我不能调用 void 方法?
- sdl软件渲染器不工作,工作在硬件加速的一个