Some first column rendered with wrong data if width of frame is not multiple of 16

Currently, I do follow steps:

  1. Get data byte array of frame from camera (YUV format)
  2. Upload YUV data then draw to FBO (shader included rgb convert, blur some pixel …)
  3. Convert texture of FBO to I420 frame, then readback data (I used YuvConverter of chromium:
    (https://chromium.googlesource.com/external/webrtc/+/HEAD/sdk/android/api/org/webrtc/YuvConverter.java)

It will work perfectly if frame width is multiple of 16. If frame width is multiple of 8 or 4, coordinate and color of some first column would be wrong. I tried GLES20.glPixelStrorei(GL_PACK/UNPACK_ALIGNMENT, 1); before call GLES20.glReadPixel, but this no effect.

From what I described, do you have any clues or approachs to find the root cause ? many thanks!

I found the cause make err, it relevant to byte alignment :