Commit 26c16829 authored by Yan, Shaobo's avatar Yan, Shaobo Committed by Commit Bot

Update WEBGL_video_texture API

This patch adds the missing API in WEBGL_video_texture spec, renames
VideoElementTargetVideoTexture to shareVideoImageWEBGL, and corrects
the success logic in shareVideoImageWEBGL.

Bug: 776222
Change-Id: I17f2839dcef9c63346348c6d155e4eb6eb877760
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2194795
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768557}
parent 332d7951
......@@ -40,7 +40,7 @@ void WebGLVideoTexture::Trace(Visitor* visitor) {
WebGLExtension::Trace(visitor);
}
VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
VideoFrameMetadata* WebGLVideoTexture::shareVideoImageWEBGL(
ExecutionContext* execution_context,
unsigned target,
HTMLVideoElement* video,
......@@ -90,10 +90,10 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
// TODO(shaobo.yan@intel.com) : A fallback path or exception needs to be
// added when video is not using gpu decoder.
video->PrepareVideoFrameForWebGL(scoped.Context()->ContextGL(), target,
texture->Object(), already_uploaded_id,
frame_metadata_ptr);
if (!frame_metadata_ptr) {
bool success = video->PrepareVideoFrameForWebGL(
scoped.Context()->ContextGL(), target, texture->Object(),
already_uploaded_id, frame_metadata_ptr);
if (!success) {
exception_state.ThrowTypeError("Failed to share video to texture.");
return nullptr;
}
......@@ -125,4 +125,13 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
#endif // defined OS_ANDROID
}
bool WebGLVideoTexture::releaseVideoImageWEBGL(
ExecutionContext* execution_context,
unsigned target,
ExceptionState& exception_state) {
// NOTE: In current WEBGL_video_texture status, there is no lock on video
// frame. So this API doesn't need to do anything.
return true;
}
} // namespace blink
......@@ -27,10 +27,12 @@ class WebGLVideoTexture final : public WebGLExtension {
// Get video frame from video frame compositor and bind it to platform
// texture.
VideoFrameMetadata* VideoElementTargetVideoTexture(ExecutionContext*,
unsigned,
HTMLVideoElement*,
ExceptionState&);
VideoFrameMetadata* shareVideoImageWEBGL(ExecutionContext*,
unsigned,
HTMLVideoElement*,
ExceptionState&);
bool releaseVideoImageWEBGL(ExecutionContext*, unsigned, ExceptionState&);
private:
Member<VideoFrameMetadata> current_frame_metadata_;
......
......@@ -12,5 +12,6 @@
const GLenum TEXTURE_VIDEO_IMAGE = 0x9248;
const GLenum SAMPLER_VIDEO_IMAGE = 0x9249;
[CallWith=ExecutionContext, RaisesException] VideoFrameMetadata VideoElementTargetVideoTexture(GLenum target, HTMLVideoElement video);
[CallWith=ExecutionContext, RaisesException] VideoFrameMetadata shareVideoImageWEBGL(GLenum target, HTMLVideoElement video);
[CallWith=ExecutionContext, RaisesException] boolean releaseVideoImageWEBGL(GLenum target);
};
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