本文整理汇总了C++中SourceBuffer::hasVideo方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceBuffer::hasVideo方法的具体用法?C++ SourceBuffer::hasVideo怎么用?C++ SourceBuffer::hasVideo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceBuffer
的用法示例。
在下文中一共展示了SourceBuffer::hasVideo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maximumMediaSourceBufferSize
size_t MediaElementSession::maximumMediaSourceBufferSize(const SourceBuffer& buffer) const
{
// A good quality 1080p video uses 8,000 kbps and stereo audio uses 384 kbps, so assume 95% for video and 5% for audio.
const float bufferBudgetPercentageForVideo = .95;
const float bufferBudgetPercentageForAudio = .05;
size_t maximum;
Settings* settings = buffer.document().settings();
if (settings)
maximum = settings->maximumSourceBufferSize();
else
maximum = fiveMinutesOf1080PVideo + fiveMinutesStereoAudio;
// Allow a SourceBuffer to buffer as though it is audio-only even if it doesn't have any active tracks (yet).
size_t bufferSize = static_cast<size_t>(maximum * bufferBudgetPercentageForAudio);
if (buffer.hasVideo())
bufferSize += static_cast<size_t>(maximum * bufferBudgetPercentageForVideo);
// FIXME: we might want to modify this algorithm to:
// - decrease the maximum size for background tabs
// - decrease the maximum size allowed for inactive elements when a process has more than one
// element, eg. so a page with many elements which are played one at a time doesn't keep
// everything buffered after an element has finished playing.
return bufferSize;
}