CVOpenGLESTextureCacheCreateTextureFromImage return -6683 (kCVReturnPixelBufferNotOpenGLCompatible) при использовании с kCVPixelFormatType_420YpCbCr8Planar - PullRequest
0 голосов
/ 17 декабря 2018

Я получаю необработанные данные YUV в 3 отдельных массивах из сетевого обратного вызова (приложение voip).Сначала я делаю:

CVPixelBufferCreate(
  kCFAllocatorDefault,
  width,
  height,
  kCVPixelFormatType_420YpCbCr8Planar,
  nil,
  @aPixelBuffer);

, затем

CVPixelBufferLockBaseAddress(aPixelBuffer, 0);
//-----
aDestPlane := CVPixelBufferGetBaseAddressOfPlane(aPixelBuffer, 0);
move(aRTCI420Buffer.dataY^, aDestPlane^, aRTCI420Buffer.width * aRTCI420Buffer.height);
//-----
aDestPlane := CVPixelBufferGetBaseAddressOfPlane(aPixelBuffer, 1);
move(aRTCI420Buffer.dataU^, aDestPlane^, (aRTCI420Buffer.chromaWidth) * (aRTCI420Buffer.chromaHeight));
//-----
aDestPlane := CVPixelBufferGetBaseAddressOfPlane(aPixelBuffer, 2);
move(aRTCI420Buffer.dataV^, aDestPlane^, (aRTCI420Buffer.chromaWidth) * (aRTCI420Buffer.chromaHeight));
//-----
CVPixelBufferUnlockBaseAddress(aPixelBuffer, 0);

, но позже, когда я пытаюсь сделать

CVOpenGLESTextureCacheCreateTextureFromImage(
  kCFAllocatorDefault, // allocator: The CFAllocator to use for allocating the texture object. This parameter can be NULL.
  fvideoTextureCacheRef, // textureCache: The texture cache object that will manage the texture.
  aPixelBuffer, // sourceImage: The CVImageBuffer that you want to create a texture from.
  nil,  // textureAttributes: A CFDictionary containing the attributes to be used for creating the CVOpenGLESTexture objects. This parameter can be NULL.
  GL_TEXTURE_2D, // target: The target texture. GL_TEXTURE_2D and GL_RENDERBUFFER are the only targets currently supported.
  GL_RED_EXT,  // internalFormat: The number of color components in the texture. Examples are GL_RGBA, GL_LUMINANCE, GL_RGBA8_OES, GL_RED, and GL_RG.
  aLumaWidth, // width: The width of the texture image.
  aLumaHeight, // height The height of the texture image.
  GL_RED_EXT,  // format: The format of the pixel data. Examples are GL_RGBA and GL_LUMINANCE.
  GL_UNSIGNED_BYTE, // type: The data type of the pixel data. One example is GL_UNSIGNED_BYTE.
  0,  // planeIndex: The plane of the CVImageBuffer to map bind. Ignored for non-planar CVImageBuffers.
  @aTextureRefLuma); // textureOut: A pointer to a CVOpenGLESTexture where the newly created texture object will be placed.

. Это не удается с -6683 (kCVReturnPixelBufferNotOpenGLCompatible).Если я изменю kCVPixelFormatType_420YpCbCr8Planar на kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange , то это будет работать, но я скучаю по цветам.Есть идеи, почему это не получается?

...