Commit eb0cda6e authored by Dale Curtis's avatar Dale Curtis Committed by Chromium LUCI CQ

Add null check for failed media::VideoFrame creation.

R=chcunningham

Fixed: 1164070
Change-Id: Ib3227d36de787bca195cffdb500f3688b3209cbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616999
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841367}
parent d2b94e32
...@@ -213,6 +213,11 @@ VideoFrame* VideoFrame::Create(ScriptState* script_state, ...@@ -213,6 +213,11 @@ VideoFrame* VideoFrame::Create(ScriptState* script_state,
// a VideoFrame instead of using writable_addr() here. // a VideoFrame instead of using writable_addr() here.
reinterpret_cast<uint8_t*>(pm.writable_addr()), pm.computeByteSize(), reinterpret_cast<uint8_t*>(pm.writable_addr()), pm.computeByteSize(),
timestamp); timestamp);
if (!frame) {
exception_state.ThrowDOMException(DOMExceptionCode::kOperationError,
"Failed to create video frame");
return nullptr;
}
frame->set_color_space(gfx::ColorSpace(*sk_color_space)); frame->set_color_space(gfx::ColorSpace(*sk_color_space));
frame->AddDestructionObserver(ConvertToBaseOnceCallback(CrossThreadBindOnce( frame->AddDestructionObserver(ConvertToBaseOnceCallback(CrossThreadBindOnce(
base::DoNothing::Once<sk_sp<SkImage>>(), std::move(sk_image)))); base::DoNothing::Once<sk_sp<SkImage>>(), std::move(sk_image))));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment