Check the availability of Metal device (#3871)

This commit is contained in:
sauwming 2024-02-27 12:54:00 +08:00 committed by GitHub
parent b0be1706ea
commit 2d6a9d4442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -217,7 +217,16 @@ static pj_status_t metal_factory_refresh(pjmedia_vid_dev_factory *f)
if (@available(macOS 10.14, iOS 12.0, *)) {
struct metal_dev_info *qdi;
unsigned l;
id<MTLDevice> device;
device = MTLCreateSystemDefaultDevice();
if (!device) {
PJ_LOG(3, (THIS_FILE, "No Metal device found"));
return PJ_SUCCESS;
} else {
[device release];
}
/* Init output device */
qdi = &qf->dev_info[qf->dev_count++];
pj_bzero(qdi, sizeof(*qdi));