本文整理汇总了C++中MediaByteRange::UnionWith方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaByteRange::UnionWith方法的具体用法?C++ MediaByteRange::UnionWith怎么用?C++ MediaByteRange::UnionWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaByteRange
的用法示例。
在下文中一共展示了MediaByteRange::UnionWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CombineRanges
void CombineRanges(const MediaByteRange& pending, const MediaByteRange& preload,
MediaByteRange& request)
{
OP_ASSERT(request.IsEmpty());
// If pending and preload overlap, let request be their union,
// clamped to pending.start.
if (!pending.IsEmpty() && !preload.IsEmpty())
{
request = pending;
request.IntersectWith(preload);
if (!request.IsEmpty())
{
// non-empty intersection => overlap
request = pending;
request.UnionWith(preload);
request.IntersectWith(MediaByteRange(pending.start));
OP_ASSERT(!request.IsEmpty());
}
}
// Otherwise, pick the first non-empty of pending and preload.
if (request.IsEmpty())
{
if (!pending.IsEmpty())
request = pending;
else
request = preload;
}
}
示例2: ReduceRanges
void ReduceRanges(const List<MediaSourceClient>& clients,
MediaByteRange& pending, MediaByteRange& preload)
{
OP_ASSERT(preload.IsEmpty());
MediaSourceClient* client = clients.First();
if (client)
{
for ( ; client; client = client->Suc())
{
// take the first non-empty pending
if (pending.IsEmpty())
pending = client->GetPending();
// preload the union of all ranges
preload.UnionWith(client->GetPreload());
}
}
else
{
// with no clients, preload the whole resource
preload.start = 0;
}
}