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.
|
// CVPixelBuffers directly to the renderer.
|
||||||
// TODO(tkchin): Maybe only set OpenGL/IOSurface keys if we know that that
|
// TODO(tkchin): Maybe only set OpenGL/IOSurface keys if we know that that
|
||||||
// we can pass CVPixelBuffers as native handles in decoder output.
|
// 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;
|
static size_t const attributesSize = 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
CFTypeRef keys[attributesSize] = {
|
CFTypeRef keys[attributesSize] = {
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
kCVPixelBufferOpenGLESCompatibilityKey,
|
kCVPixelBufferOpenGLESCompatibilityKey,
|
||||||
#elif defined(WEBRTC_MAC)
|
#elif defined(WEBRTC_MAC)
|
||||||
kCVPixelBufferOpenGLCompatibilityKey,
|
kCVPixelBufferOpenGLCompatibilityKey,
|
||||||
#endif
|
#endif
|
||||||
kCVPixelBufferIOSurfacePropertiesKey,
|
#if !(TARGET_OS_SIMULATOR)
|
||||||
kCVPixelBufferPixelFormatTypeKey
|
kCVPixelBufferIOSurfacePropertiesKey,
|
||||||
};
|
#endif
|
||||||
|
kCVPixelBufferPixelFormatTypeKey};
|
||||||
CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
|
CFDictionaryRef ioSurfaceValue = CreateCFTypeDictionary(nullptr, nullptr, 0);
|
||||||
int64_t nv12type = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
|
int64_t nv12type = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
|
||||||
CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &nv12type);
|
CFNumberRef pixelFormat = CFNumberCreate(nullptr, kCFNumberLongType, &nv12type);
|
||||||
|
#if TARGET_OS_SIMULATOR
|
||||||
|
CFTypeRef values[attributesSize] = {kCFBooleanTrue, pixelFormat};
|
||||||
|
#else
|
||||||
CFTypeRef values[attributesSize] = {kCFBooleanTrue, ioSurfaceValue, pixelFormat};
|
CFTypeRef values[attributesSize] = {kCFBooleanTrue, ioSurfaceValue, pixelFormat};
|
||||||
|
#endif
|
||||||
|
|
||||||
CFDictionaryRef attributes = CreateCFTypeDictionary(keys, values, attributesSize);
|
CFDictionaryRef attributes = CreateCFTypeDictionary(keys, values, attributesSize);
|
||||||
if (ioSurfaceValue) {
|
if (ioSurfaceValue) {
|
||||||
CFRelease(ioSurfaceValue);
|
CFRelease(ioSurfaceValue);
|
||||||
|
Reference in New Issue
Block a user