Skip to content

Commit

Permalink
setSampleBufferAsDisplayImmediately should check that attachment arra…
Browse files Browse the repository at this point in the history
…y is not null

https://bugs.webkit.org/show_bug.cgi?id=262556
rdar://115712997

Reviewed by Brent Fulgham.

CMSampleBufferGetSampleAttachmentsArray may return a null attachment array even if createIfNecessary = true, in case of error.
In that case, make sure setSampleBufferAsDisplayImmediately bails out early.

* Source/WebCore/platform/graphics/avfoundation/objc/LocalSampleBufferDisplayLayer.mm:
(WebCore::setSampleBufferAsDisplayImmediately):

Canonical link: https://commits.webkit.org/268802@main
  • Loading branch information
youennf authored and Brent Fulgham committed Oct 3, 2023
1 parent 7ab6aab commit 53867c1
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ static void runWithoutAnimations(const WTF::Function<void()>& function)
static void setSampleBufferAsDisplayImmediately(CMSampleBufferRef sampleBuffer)
{
CFArrayRef attachmentsArray = PAL::CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, true);
if (!attachmentsArray)
return;
for (CFIndex i = 0; i < CFArrayGetCount(attachmentsArray); ++i) {
CFMutableDictionaryRef attachments = checked_cf_cast<CFMutableDictionaryRef>(CFArrayGetValueAtIndex(attachmentsArray, i));
CFDictionarySetValue(attachments, PAL::kCMSampleAttachmentKey_DisplayImmediately, kCFBooleanTrue);
Expand Down

0 comments on commit 53867c1

Please sign in to comment.