Ijkplayer: 调用mediacodec黑屏问题

Created on 3 Dec 2016  ·  4Comments  ·  Source: bilibili/ijkplayer

想让播放器优先使用硬解码,启用了mediacodec,
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
但是有一些机型上会黑屏,请问该怎样设置让它可以自动切换软解码?
求解答。

Most helpful comment

吃瓜群众路过,你可以在TextureView的onSurfaceTextureUpdated中,通过TextureView.getBitmap()获取到画面,如果好几个画面的bitmap都是rgb 000的黑色,说明一直黑屏,切换为软解 ,有点野路子,刚好看到了就表达下看法,哈哈哈。。。。

All 4 comments

吃瓜群众路过,你可以在TextureView的onSurfaceTextureUpdated中,通过TextureView.getBitmap()获取到画面,如果好几个画面的bitmap都是rgb 000的黑色,说明一直黑屏,切换为软解 ,有点野路子,刚好看到了就表达下看法,哈哈哈。。。。

@CarGuo 再请教一下,只设置了SurfaceTexture的该怎么获取画面判断是不是黑屏?就是拿到了texture然后传给Unity了

surfaceview上的可以通过
Canvas canvas=holder.lockCanvas();
bitmap=BitmapFactory.xxxx;
canvas.drawBitmap(bitmap, 0, 0, null);
holder.unlockCanvasAndPost(canvas);类似这样,但是SurfaceTexture就不清楚了,没用过呢

@CarGuo 谢谢

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuraoff picture yuraoff  ·  3Comments

xSharkM picture xSharkM  ·  3Comments

ZINK-FU picture ZINK-FU  ·  3Comments

zyi1992 picture zyi1992  ·  5Comments

lingchen52 picture lingchen52  ·  3Comments