我在 Nexus 5 上运行 Grafika MediaCodec 示例代码,并对 MoviePlayer.java 进行了一些简单的计时。我在以下位置添加了日志记录语句:
在244行之后
我使用
以下是来自logcat的摘录:
我发现第一个输入缓冲区排队到相应的输出缓冲区出列的时间差为50毫秒。这对于硬件加速解码来说似乎是很长的时间。 有没有办法减少这种延迟?
203 行之前
请注意,需要保留原文中的 和 标记。decoder.queueInputBuffer
在244行之后
decoder.dequeueOutputBuffer
我使用
presentationTimeUs
相关联日志语句。以下是来自logcat的摘录:
01-29 10:56:43.295: I/Grafika(21286): queueInputBuffer index/pts, 2,0
01-29 10:56:43.305: I/Grafika(21286): queueInputBuffer index/pts, 0,33100
01-29 10:56:43.315: I/Grafika(21286): queueInputBuffer index/pts, 3,66466
01-29 10:56:43.325: I/Grafika(21286): queueInputBuffer index/pts, 1,99833
01-29 10:56:43.325: I/Grafika(21286): queueInputBuffer index/pts, 2,133200
01-29 10:56:43.335: I/Grafika(21286): queueInputBuffer index/pts, 0,166566
01-29 10:56:43.345: I/ATSParser(21286): discontinuity on stream pid 0x1011
01-29 10:56:43.345: I/ATSParser(21286): discontinuity on stream pid 0x1100
01-29 10:56:43.345: I/Grafika(21286): queueInputBuffer index/pts, 3,199933
01-29 10:56:43.345: I/Grafika(21286): dequeueOutputBuffer index/pts, 7,0
01-29 10:56:43.345: I/Grafika(21286): queueInputBuffer index/pts, 1,300033
01-29 10:56:43.355: I/Grafika(21286): dequeueOutputBuffer index/pts, 6,33100
01-29 10:56:43.385: I/Grafika(21286): queueInputBuffer index/pts, 2,333400
01-29 10:56:43.385: I/Grafika(21286): dequeueOutputBuffer index/pts, 5,66466
01-29 10:56:43.415: I/Grafika(21286): queueInputBuffer index/pts, 0,366766
01-29 10:56:43.415: I/Grafika(21286): dequeueOutputBuffer index/pts, 4,99833
01-29 10:56:43.445: I/Grafika(21286): queueInputBuffer index/pts, 3,400133
01-29 10:56:43.445: I/Grafika(21286): dequeueOutputBuffer index/pts, 3,133200
我发现第一个输入缓冲区排队到相应的输出缓冲区出列的时间差为50毫秒。这对于硬件加速解码来说似乎是很长的时间。 有没有办法减少这种延迟?