Skip to content
Permalink
Browse files

Enable video frames as OES textures

This patch parametrizes WR to handle OES textures if the incoming
frame wraps one.

It requires the update of servo-media package and the according
WR parametrization.
  • Loading branch information...
ceyusa committed Sep 10, 2019
1 parent 6ed204d commit c6df00343b512ed4a2c3680689cc99c459681535
Showing with 25 additions and 13 deletions.
  1. +11 −11 Cargo.lock
  2. +14 −2 components/script/dom/htmlmediaelement.rs

Some generated files are not rendered by default. Learn more.

@@ -214,13 +214,19 @@ impl FrameRenderer for MediaFrameRenderer {
*height = frame.get_height();

let image_data = if frame.is_gl_texture() && self.player_id.is_some() {
let texture_target = if frame.is_external_oes() {
TextureTarget::External
} else {
TextureTarget::Default
};

self.current_frame_holder
.get_or_insert_with(|| FrameHolder::new(frame.clone()))
.set(frame);
ImageData::External(ExternalImageData {
id: ExternalImageId(self.player_id.unwrap()),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(TextureTarget::Default),
image_type: ExternalImageType::TextureHandle(texture_target),
})
} else {
ImageData::Raw(frame.get_data())
@@ -232,11 +238,17 @@ impl FrameRenderer for MediaFrameRenderer {
self.current_frame = Some((image_key, frame.get_width(), frame.get_height()));

let image_data = if frame.is_gl_texture() && self.player_id.is_some() {
let texture_target = if frame.is_external_oes() {
TextureTarget::External
} else {
TextureTarget::Default
};

self.current_frame_holder = Some(FrameHolder::new(frame));
ImageData::External(ExternalImageData {
id: ExternalImageId(self.player_id.unwrap()),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(TextureTarget::Default),
image_type: ExternalImageType::TextureHandle(texture_target),
})
} else {
ImageData::Raw(frame.get_data())

0 comments on commit c6df003

Please sign in to comment.
You can’t perform that action at this time.