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) { ...@@ -40,7 +40,7 @@ void WebGLVideoTexture::Trace(Visitor* visitor) {
WebGLExtension::Trace(visitor); WebGLExtension::Trace(visitor);
} }
VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture( VideoFrameMetadata* WebGLVideoTexture::shareVideoImageWEBGL(
ExecutionContext* execution_context, ExecutionContext* execution_context,
unsigned target, unsigned target,
HTMLVideoElement* video, HTMLVideoElement* video,
...@@ -90,10 +90,10 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture( ...@@ -90,10 +90,10 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
// TODO(shaobo.yan@intel.com) : A fallback path or exception needs to be // TODO(shaobo.yan@intel.com) : A fallback path or exception needs to be
// added when video is not using gpu decoder. // added when video is not using gpu decoder.
video->PrepareVideoFrameForWebGL(scoped.Context()->ContextGL(), target, bool success = video->PrepareVideoFrameForWebGL(
texture->Object(), already_uploaded_id, scoped.Context()->ContextGL(), target, texture->Object(),
frame_metadata_ptr); already_uploaded_id, frame_metadata_ptr);
if (!frame_metadata_ptr) { if (!success) {
exception_state.ThrowTypeError("Failed to share video to texture."); exception_state.ThrowTypeError("Failed to share video to texture.");
return nullptr; return nullptr;
} }
...@@ -125,4 +125,13 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture( ...@@ -125,4 +125,13 @@ VideoFrameMetadata* WebGLVideoTexture::VideoElementTargetVideoTexture(
#endif // defined OS_ANDROID #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 } // namespace blink
...@@ -27,11 +27,13 @@ class WebGLVideoTexture final : public WebGLExtension { ...@@ -27,11 +27,13 @@ class WebGLVideoTexture final : public WebGLExtension {
// Get video frame from video frame compositor and bind it to platform // Get video frame from video frame compositor and bind it to platform
// texture. // texture.
VideoFrameMetadata* VideoElementTargetVideoTexture(ExecutionContext*, VideoFrameMetadata* shareVideoImageWEBGL(ExecutionContext*,
unsigned, unsigned,
HTMLVideoElement*, HTMLVideoElement*,
ExceptionState&); ExceptionState&);
bool releaseVideoImageWEBGL(ExecutionContext*, unsigned, ExceptionState&);
private: private:
Member<VideoFrameMetadata> current_frame_metadata_; Member<VideoFrameMetadata> current_frame_metadata_;
}; };
......
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
const GLenum TEXTURE_VIDEO_IMAGE = 0x9248; const GLenum TEXTURE_VIDEO_IMAGE = 0x9248;
const GLenum SAMPLER_VIDEO_IMAGE = 0x9249; 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