MediaCodec解码器奇怪的行为

时间:2013-11-12 20:53:04

标签: android decoder mediacodec

在我的实现中,我使用MediaCodec解码器逐帧顺序解码视频,一切正常。但是如果在开始解码过程之前我使用MediaPlayer和TextureView(我使用GLES渲染的扩展TextureView)播放一些媒体,第四个解码器将不会正常工作,例如当outputFormat改变时,它会为编解码器返回错误的颜色格式而前三个解码器正常工作。 我知道这主要取决于硬件,但任何想法都会特别受到与MediaPlayer关系的影响。

p.s:在开始解码之前,我会释放并清理MediaPlayer实例。

编辑:

该设备是三星Note3,我正在播放常规媒体。当它失败时,即使我等待几分钟,或者如果我强制停止活动并重新运行它,除非我重新启动设备,否则行为仍然存在。您可以在以下日志中看到的预期颜色格式为“QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m”。

失败前:

...MediaEditor( 6837): [503] decoder0 output format changed: {height=720,   what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [503] decoder1 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [503] decoder2 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [503] decoder3 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}

失败后:

...MediaEditor( 6837): [503] decoder0 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [503] decoder1 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [503] decoder2 output format changed: {height=720, what=1869968451, color-format=2141391876, slice-height=736, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [512] surface decoder0 given buffer 0 (size=1413120)
...MediaEditor( 6837): [512] surface decoder1 given buffer 0 (size=1413120)
...MediaEditor( 6837): [512] surface decoder2 given buffer 0 (size=1413120)
...MediaEditor( 6837): [503] decoder3 output format changed: {height=720, what=1869968451, color-format=19, slice-height=720, crop-left=0, width=1280, crop-bottom=719, crop-top=0, mime=video/raw, stride=1280, crop-right=1279}
...MediaEditor( 6837): [512] surface decoder0 given buffer 1 (size=1413120)
...MediaEditor( 6837): [512] surface decoder1 given buffer 1 (size=1413120)
...MediaEditor( 6837): [512] surface decoder2 given buffer 1 (size=1413120)
...MediaEditor( 6837): [512] surface decoder3 given buffer 0 (size=1382400)

0 个答案:

没有答案