Skip to content
Permalink
Browse files

Always hold current frame

Regardless if it contains raw data or a gl texture.

It is required to hold current frame because it can be used for
webgl's get_image_pixels
  • Loading branch information...
ceyusa committed Sep 17, 2019
1 parent dc65d82 commit bc07154e05f5666b3a8c0e7d1e4a92bd395423a3
Showing with 12 additions and 8 deletions.
  1. +12 −8 components/script/dom/htmlmediaelement.rs
@@ -193,12 +193,12 @@ impl FrameRenderer for MediaFrameRenderer {
ImageData::Raw(frame.get_data()),
&webrender_api::DirtyRect::All,
);
} else if self.player_id.is_some() {
self.current_frame_holder
.get_or_insert_with(|| FrameHolder::new(frame.clone()))
.set(frame);
}

self.current_frame_holder
.get_or_insert_with(|| FrameHolder::new(frame.clone()))
.set(frame);

if let Some(old_image_key) = self.old_frame.take() {
txn.delete_image(old_image_key);
}
@@ -220,9 +220,6 @@ impl FrameRenderer for MediaFrameRenderer {
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,
@@ -231,6 +228,11 @@ impl FrameRenderer for MediaFrameRenderer {
} else {
ImageData::Raw(frame.get_data())
};

self.current_frame_holder
.get_or_insert_with(|| FrameHolder::new(frame.clone()))
.set(frame);

txn.add_image(new_image_key, descriptor, image_data, None);
},
None => {
@@ -244,7 +246,6 @@ impl FrameRenderer for MediaFrameRenderer {
TextureTarget::Default
};

self.current_frame_holder = Some(FrameHolder::new(frame));
ImageData::External(ExternalImageData {
id: ExternalImageId(self.player_id.unwrap()),
channel_index: 0,
@@ -253,6 +254,9 @@ impl FrameRenderer for MediaFrameRenderer {
} else {
ImageData::Raw(frame.get_data())
};

self.current_frame_holder = Some(FrameHolder::new(frame));

txn.add_image(image_key, descriptor, image_data, None);
},
}

0 comments on commit bc07154

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