I am using Surface to show bitmap from JNI, to show a video, this is my code :
SurfaceHolder holder = surfaceView.getHolder();
while(true) {
if(getBitmap() == null) {
continue;
}
Canvas canvas = holder.lockCanvas();
canvas.drawBitmap(getBitmap(), matrix, null);
if(viewInterface == null) {
break;
}
holder.unlockCanvasAndPost(canvas);
setBitmap(null);
}
I went to calculate the time spent in each method,I found that the method
//longest time consuming 71ms
holder.lockCanvas();
//longest time consuming 50ms
canvas.drawBitmap(getBitmap(), matrix, null);
//longest time consuming 111ms
holder.unlockCanvasAndPost(canvas);
I don't know where the problem is, what happens next time to drawBitmap for so long time