• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Allocation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer2.upstream.Allocation的典型用法代码示例。如果您正苦于以下问题:Java Allocation类的具体用法?Java Allocation怎么用?Java Allocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Allocation类属于com.google.android.exoplayer2.upstream包,在下文中一共展示了Allocation类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readData

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
/**
 * Reads data from the front of the rolling buffer.
 *
 * @param absolutePosition The absolute position from which data should be read.
 * @param target The array into which data should be written.
 * @param length The number of bytes to read.
 */
private void readData(long absolutePosition, byte[] target, int length) {
  advanceReadTo(absolutePosition);
  int remaining = length;
  while (remaining > 0) {
    int toCopy = Math.min(remaining, (int) (readAllocationNode.endPosition - absolutePosition));
    Allocation allocation = readAllocationNode.allocation;
    System.arraycopy(allocation.data, readAllocationNode.translateOffset(absolutePosition),
        target, length - remaining, toCopy);
    remaining -= toCopy;
    absolutePosition += toCopy;
    if (absolutePosition == readAllocationNode.endPosition) {
      readAllocationNode = readAllocationNode.next;
    }
  }
}
 
开发者ID:y20k,项目名称:transistor,代码行数:23,代码来源:SampleQueue.java


示例2: clearAllocationNodes

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
/**
 * Clears allocation nodes starting from {@code fromNode}.
 *
 * @param fromNode The node from which to clear.
 */
private void clearAllocationNodes(AllocationNode fromNode) {
  if (!fromNode.wasInitialized) {
    return;
  }
  // Bulk release allocations for performance (it's significantly faster when using
  // DefaultAllocator because the allocator's lock only needs to be acquired and released once)
  // [Internal: See b/29542039].
  int allocationCount = (writeAllocationNode.wasInitialized ? 1 : 0)
      + ((int) (writeAllocationNode.startPosition - fromNode.startPosition) / allocationLength);
  Allocation[] allocationsToRelease = new Allocation[allocationCount];
  AllocationNode currentNode = fromNode;
  for (int i = 0; i < allocationsToRelease.length; i++) {
    allocationsToRelease[i] = currentNode.allocation;
    currentNode = currentNode.clear();
  }
  allocator.release(allocationsToRelease);
}
 
开发者ID:y20k,项目名称:transistor,代码行数:23,代码来源:SampleQueue.java


示例3: readData

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
/**
 * Reads data from the front of the rolling buffer.
 *
 * @param absolutePosition The absolute position from which data should be read.
 * @param target The buffer into which data should be written.
 * @param length The number of bytes to read.
 */
private void readData(long absolutePosition, ByteBuffer target, int length) {
  int remaining = length;
  while (remaining > 0) {
    dropDownstreamTo(absolutePosition);
    int positionInAllocation = (int) (absolutePosition - totalBytesDropped);
    int toCopy = Math.min(remaining, allocationLength - positionInAllocation);
    Allocation allocation = dataQueue.peek();
    target.put(allocation.data, allocation.translateOffset(positionInAllocation), toCopy);
    absolutePosition += toCopy;
    remaining -= toCopy;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:20,代码来源:DefaultTrackOutput.java


示例4: clearSampleData

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
private void clearSampleData() {
  infoQueue.clearSampleData();
  allocator.release(dataQueue.toArray(new Allocation[dataQueue.size()]));
  dataQueue.clear();
  allocator.trim();
  totalBytesDropped = 0;
  totalBytesWritten = 0;
  lastAllocation = null;
  lastAllocationOffset = allocationLength;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:11,代码来源:DefaultTrackOutput.java


示例5: clearSampleData

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
private void clearSampleData() {
  infoQueue.clearSampleData();
  allocator.release(dataQueue.toArray(new Allocation[dataQueue.size()]));
  dataQueue.clear();
  allocator.trim();
  totalBytesDropped = 0;
  totalBytesWritten = 0;
  lastAllocation = null;
  lastAllocationOffset = allocationLength;
  needKeyframe = true;
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:12,代码来源:DefaultTrackOutput.java


示例6: initialize

import com.google.android.exoplayer2.upstream.Allocation; //导入依赖的package包/类
/**
 * Initializes the node.
 *
 * @param allocation The node's {@link Allocation}.
 * @param next The next {@link AllocationNode}.
 */
public void initialize(Allocation allocation, AllocationNode next) {
  this.allocation = allocation;
  this.next = next;
  wasInitialized = true;
}
 
开发者ID:y20k,项目名称:transistor,代码行数:12,代码来源:SampleQueue.java



注:本文中的com.google.android.exoplayer2.upstream.Allocation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ColumnSortedMap类代码示例发布时间:2022-05-15
下一篇:
Java AdCustomFieldValue类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap