Skip to content

Commit

Permalink
Check the availability of Metal device (#3871)
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming authored Feb 27, 2024
1 parent b0be170 commit 2d6a9d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pjmedia/src/pjmedia-videodev/metal_dev.m
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 2d6a9d4

Please sign in to comment.