媒体codeC不返回缓冲区时Traceview方法剖析正在运行 [英] MediaCodec does not return buffers when Traceview Method Profiling is running

查看:168
本文介绍了媒体codeC不返回缓冲区时Traceview方法剖析正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是媒体codeC启用Traceview方法探查时未返回的输入或输出缓冲器。重现步骤:

It seems like MediaCodec does not return input or output buffers when Traceview Method Profiling is enabled. Steps to reproduce:


  1. 在Eclipse中,运行Grafika。

  2. 在Grafika,选择播放视频(TextureView),然后点击开始。

  3. 在Eclipse中DDMS,点击开始方法剖析和保持对话框打开。

  4. 在Grafika,点击播放,迅速回到Eclipse,然后单击确定。一旦你点击确定,Grafika会出现挂(它不作出任何更多的帧)。

Grafika详细日志显示,直到方法剖析停止没有输入或输出缓冲器可从媒体codeC。

Grafika verbose logs show that no input or output buffer is available from MediaCodec until Method Profiling is stopped.

我的猜测是媒体codeC确实在幕后,也许有些东西活套与Traceview是如何实现的,但是这只是一个猜测的冲突。

My guess is that MediaCodec does some Looper stuff under the covers and maybe that conflicts with how Traceview is implemented, but that is just a guess.

这是一个已知的问题?有没有办法通过媒体codeC要解决它,轮廓应用程序?

Is this a known issue? Is there a way to workaround it and profile apps using MediaCodec?

推荐答案

哎呦。

的Dalvik / VM / Thread.cpp (行2105):

/*
 * If we're doing method trace profiling, we don't want threads to exit,
 * because if they do we'll end up reusing thread IDs.  This complicates
 * analysis and makes it impossible to have reasonable output in the
 * "threads" section of the "key" file.

按说这优秀作品出来 - 如果线程退出,它没有任何剩下要做的,所以如果我们把它周围的时间长一点也没关系。为线程#信令连接()已经发生了,所以没有什么剩下要做的。

Ordinarily this works out fine -- if the thread is exiting, it has nothing left to do, so it doesn't matter if we keep it around a bit longer. The signaling for Thread#join() has already happened, so there's nothing left to do.

但在这种情况下,线程的暂时的由本机连接到虚拟机 A codeC 线程提供了 onFrameAvailable()回调。所以这个纯本地线程想把自身连接到虚拟机,调用回调,分离本身,回去工作。但是,由于方法分析处于活动状态,线程分离摊位,直到方法分析完成......但方法分析将无法完成,直到code继续执行。所以我们陷入僵局。

But in this case, the thread was temporarily attached to the VM by the native ACodec thread that provides the onFrameAvailable() callback. So this pure-native thread wants to attach itself to the VM, invoke the callback, detach itself, and go back to work. But because method profiling is active, the thread detach stalls until method profiling completes... but method profiling won't complete until code execution resumes. So we're deadlocked.

因此​​,这里有两个问题:

So there's two problems here:


  1. 的Dalvik不应该保持线程活着。它将使法分析更加复杂,因为它失去了独特的便利线程ID,但是这只是一个看家的事情。

  2. libstagefright不应被安装和拆卸每次要发送一个帧可用消息的时间。这是一个相对昂贵的操作,需要分配一个线程对象,挫败尝试运行自由分配-

我没有看到一个干净的方式改变应用程序来解决这个 - 你不得不去无框架可用的通知。最好的办法是放弃了TraceView分析和使用 systrace 来代替。

I don't see a clean way to work around this by changing the app -- you'd have to go without the frame available notification. The best bet is to forgo the TraceView profiling and use systrace instead.

这篇关于媒体codeC不返回缓冲区时Traceview方法剖析正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆