Fix crash during display layer reinitialization

This commit is contained in:
Cameron Gutman
2022-03-27 14:14:19 -05:00
parent 9ea5e2ec99
commit 3b0d80bce2

View File

@@ -311,13 +311,9 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit);
if (displayLayer.status == AVQueuedSampleBufferRenderingStatusFailed) {
Log(LOG_E, @"Display layer rendering failed: %@", displayLayer.error);
// Recreate the display layer on the main thread.
// We need to use dispatch_sync() or we may miss
// some parameter sets while the layer is being
// recreated.
dispatch_sync(dispatch_get_main_queue(), ^{
[self reinitializeDisplayLayer];
});
// Recreate the display layer. We are already on the main thread,
// so this is safe to do right here.
[self reinitializeDisplayLayer];
// Request an IDR frame to initialize the new decoder
free(data);