@Override
public void run() {
while (!stop) {
Canvas canvas = holder.lockCanvas();
int[] colors = ffmpeg4Buffer.getRGB();

if (colors != null) {
canvas.drawBitmap(colors, 0, 704, 0, 0, width, height, false, null);
}

holder.unlockCanvasAndPost(canvas);
}
}
使用继承SurfaceView,并实现SurfaceHolder.Callback接口
即可显示。

解决方案 »

  1.   

     704 是 offsize 我添了视频宽还是不行。
    我解码后是RGB24 类型为byte[];       int[] colors = new int[width * height * numBands];
         for(int i = 0; i < width * height * numBands -1; i++)
         {
          colors[i] = byteArray[i];       
         }      
                     if (colors != null) {
                      canvas.drawBitmap(colors, 0, width, 0, 0, width, height, false, null); 
                     }