- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将我的相机提要编码为 VP8。问题是:当我从输出缓冲区获取帧时,字节数组的大小始终不同,但所有条目均为 0。
这是我抓取框架并打印它的代码:
while (true) {
try {
encoderIndex = mEncoder.dequeueOutputBuffer(encoderOutputInfo, timeOut);
} catch (Exception e) {
e.printStackTrace();
}
switch (encoderIndex) {
case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED:
// something
break;
case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:
// something else
break;
case MediaCodec.INFO_TRY_AGAIN_LATER:
// something completely different
break;
default:
// get encoded frame
byte[] frame = new byte[encoderOutputInfo.size];
mEncoderOutputBuffers[encoderIndex].get(frame);
Log.v(tag, "got frame. size: " + frame.length);
Log.v(tag, "printing frame");
Log.v(tag, printBytesAsBinary(frame));
mEncoderOutputBuffers[encoderIndex].clear();
// release encoder output buffer
mEncoder.releaseOutputBuffer(encoderIndex, false);
}
和 Logcat 打印:
02-07 11:48:19.014: V/GoogleEncoder(24883): got frame. size: 427
02-07 11:48:19.014: V/GoogleEncoder(24883): printing frame
02-07 11:48:19.014: V/GoogleEncoder(24883): 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
02-07 11:48:20.544: V/GoogleEncoder(24883): got frame. size: 379
02-07 11:48:20.544: V/GoogleEncoder(24883): printing frame
02-07 11:48:20.544: V/GoogleEncoder(24883): 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
任何人都已经遇到过这个问题并且可以告诉我我可能做错了什么?我已经尝试过弄乱输出缓冲区(例如 rewind()),但似乎没有任何效果。
奇怪的是,编码适用于 Cyanogenmod 11 的设备,它也是 4.4(在 S3 上试过)
最佳答案
MediaCodec
没有将 ByteBuffer
放在正确的位置。您需要在调用 dequeueOutputBuffer()
之后手动定位它:
int encoderStatus = encoder.dequeueOutputBuffer(info, TIMEOUT_USEC);
...
ByteBuffer encodedData = encoderOutputBuffers[encoderStatus];
encodedData.position(info.offset);
encodedData.limit(info.offset + info.size);
(参见 EncodeDecodeTest。)这与 rewind()
不同,尽管我有点惊讶它不起作用——我本以为输出通常从缓冲区的开头。
VP8 存在一些已知问题在 Android 4.3 上,尽管您似乎没有达到这些目标。
如果这不能解决您的问题,那么了解您正在使用的设备(Android 和 Cyanogen 的 S3?)、Android 软件版本、查看您用于 的代码会很有帮助configure()
MediaCodec
,以及使用的值。
关于android - VP8 编码 Nexus 5 返回空/0 帧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21626156/
以下代码在gcc中没有问题。在 VS 2010 Express 中,它无法给出 ------ Build started: Project: helium, Configuration: Debug
我有一个我不明白的光线生成问题。我的光线方向计算错误。我将这段代码从 DirectX 11 移植到 Vulkan,在那里它运行良好,所以我很惊讶我无法让它运行: vec4 farPos = inver
我需要从依存分析树中提取形式为 NP-VP-NP 的三元组,作为 Stanford Parser 中词汇化分析的输出。 执行此操作的最佳方法是什么。例如如果解析树如下: (ROOT (S
我正在为我正在开发的项目制作序列图。没有什么太复杂,只是一些来回调用的生命线。 问题是,在近距离时,我的消息描述的白色背景框会盖住我的生命线框和虚线之类的东西。您可以在下图中看到问题,尽管我尝试将它们
实际上,我使用 Java 从西类牙语文本中提取三元组。我需要提取 NP-VP-NP 形式的三元组。我也在使用斯坦福解析器 CoreNLP v 3.7.0 和西类牙语模型 v 3.7.0。接下来我的问题
我想根据连词和逗号分割树。例如,当我有 VP 和 VP 或 NP 和 NP 或 VP, VP 或 NP,NP 时,我想分别提取每个 VP 或 NP。我有以下代码: List subtrees = c
#include #include #include int mms; int ps; int rp; struct node{ int *pf; int *vp; } *pt=NULL; vo
我有一个示例,其中斯坦福 NLP 为句子输出了一个奇怪的解析树: Clean my desk (ROOT (NP (NP (JJ Clean)) (NP (PRP$ my) (NN
我的 ERD 是 alt text http://files.getdropbox.com/u/175564/db/db-8.png 我现在使用 integer(2) 来表示数据类型是 boolean
我无法启动android模拟器,它总是退出并出现错误:WHPX: Unexpected VP exit code 5 . 我使用了 Android Studio 3.6.2 和最新的 AVD,并安装了
我想计算文本中 pp/np/vp 的数量,但我不知道如何在 openNLP chunker 中识别 PP-tags/NP-tags/VP-tags?我已经尝试过这段代码,但它不起作用。 Chunker
我需要表示这样的重载方法: +setAttribute(int) +setAttribute(float) +setAttribute(boolean) 在单个 Java 类中。 VP UML 不允许
我正在使用 Stanford CoreNLP,我知道它不支持句子分块。我正在寻找的是,给定一个输入句子,将类似这样的内容作为输出: [NP He ] [VP reckons ] [NP the cu
当我想创建散点图矩阵时,出现错误 Error in grid.Call.graphics(C_downviewport, name$name, strict) : Viewport 'plot_01.
输出中有 Give me 0 0 #include #define fsv(i , n) for(int i = 0 ; i > n ; vector > > vp(n); vector v
我正在使用 vimeo 播放器在我的页面上嵌入视频。 由于某些原因,视频的缩略图在 Safari 中有 vp-preview-invisible 类(这使得缩略图不可见),但在 Chrome 中没有这
我正在使用 vimeo 播放器在我的页面上嵌入视频。 由于某些原因,视频的缩略图在 Safari 中有 vp-preview-invisible 类(这使得缩略图不可见),但在 Chrome 中没有这
我是一名优秀的程序员,十分优秀!