Do not abort if a MultiFrameCodec is unable to allocate a bitmap buffer (flutter/engine#37534)

Fixes https://github.com/flutter/flutter/issues/113014
This commit is contained in:
Jason Simmons
2022-11-18 09:12:33 -08:00
committed by GitHub
parent 84d7d73ede
commit 7c78372566

View File

@@ -93,7 +93,11 @@ sk_sp<DlImage> MultiFrameCodec::State::GetNextFrameImage(
SkImageInfo updated = info.makeAlphaType(kPremul_SkAlphaType);
info = updated;
}
bitmap.allocPixels(info);
if (!bitmap.tryAllocPixels(info)) {
FML_LOG(ERROR) << "Failed to allocate memory for bitmap of size "
<< info.computeMinByteSize() << "B";
return nullptr;
}
ImageGenerator::FrameInfo frameInfo =
generator_->GetFrameInfo(nextFrameIndex_);