Fix h264 decoding on iOS Simulator by not using IOSurface
Bug: None Change-Id: I8ccd7b82e3303c21221417a6673f6fbd15719428 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182340 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31981}
This commit is contained in:

committed by
Commit Bot

parent
233cb55511
commit
f7cf133ad5
@ -202,20 +202,31 @@ void decompressionOutputCallback(void *decoderRef,
|
||||
// CVPixelBuffers directly to the renderer.
|
||||
// TODO(tkchin): Maybe only set OpenGL/IOSurface keys if we know that that
|
||||
// we can pass CVPixelBuffers as native handles in decoder output.
|
||||
#if TARGET_OS_SIMULATOR
|
||||
static size_t const attributesSize = 2;
|
||||
#else
|
||||
static size_t const attributesSize = 3;
|
||||
#endif
|
||||
|
||||
CFTypeRef keys[attributesSize] = {
|
||||
#if defined(WEBRTC_IOS)
|
||||
kCVPixelBufferOpenGLESCompatibilityKey,
|
||||
kCVPixelBufferOpenGLESCompatibilityKey,
|
||||
#elif defined(WEBRTC_MAC)
|
||||
kCVPixelBufferOpenGLCompatibilityKey,
|
||||
kCVPixelBufferOpenGLCompatibilityKey,
|
||||
#endif
|
||||
kCVPixelBufferIOSurfacePropertiesKey,
|
||||
kCVPixelBufferPixelFormatTypeKey
|
||||
};
|
||||
#if !(TARGET_OS_SIMULATOR)
|
||||
kCVPixelBufferIOSurfacePropertiesKey,
|
||||
#endif
|
||||
kCVPixelBufferPixelFormatTypeKey};
|
||||
CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
|
||||
int64_t nv12type = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
|
||||
CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &nv12type);
|
||||
#if TARGET_OS_SIMULATOR
|
||||
CFTypeRef values[attributesSize] = {kCFBooleanTrue, pixelFormat};
|
||||
#else
|
||||
CFTypeRef values[attributesSize] = {kCFBooleanTrue, ioSurfaceValue, pixelFormat};
|
||||
#endif
|
||||
|
||||
CFDictionaryRef attributes = CreateCFTypeDictionary(keys, values, attributesSize);
|
||||
if (ioSurfaceValue) {
|
||||
CFRelease(ioSurfaceValue);
|
||||
|
Reference in New Issue
Block a user