aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-11-26 06:41:33 -0500
committerGitHub <noreply@github.com>2019-11-26 06:41:33 -0500
commit799057f1e62d96bbc765ac378c78d9f1049b6ced (patch)
treec8c006a538b9e8d8cba4c68c8ce2bafb070a3887
parent75aba2b7d95588ded6f0383057b96cc871410c5a (diff)
parent2356f3ea6b9d0e3bb5f204a1d2b59346bb5e6266 (diff)
downloadservo-799057f1e62d96bbc765ac378c78d9f1049b6ced.tar.gz
servo-799057f1e62d96bbc765ac378c78d9f1049b6ced.zip
Auto merge of #24863 - asajeffrey:gstplugin-resizing, r=ferjm
The gstreamer plugin should resize when it's presented with frames to fill <!-- Please describe your changes on the following line: --> This is a workaround for race conditions in the embedder. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #24835 - [x] These changes do not require tests because it's fixing a bug with an embedding <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
-rw-r--r--ports/gstplugin/servosrc.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/ports/gstplugin/servosrc.rs b/ports/gstplugin/servosrc.rs
index 1698a711031..9bc884dc347 100644
--- a/ports/gstplugin/servosrc.rs
+++ b/ports/gstplugin/servosrc.rs
@@ -485,11 +485,6 @@ impl BaseSrcImpl for ServoSrc {
fn set_caps(&self, _src: &BaseSrc, outcaps: &Caps) -> Result<(), LoggableError> {
let info = VideoInfo::from_caps(outcaps)
.ok_or_else(|| gst_loggable_error!(CATEGORY, "Failed to get video info"))?;
- let size = Size2D::new(info.width(), info.height()).to_i32();
- debug!("Setting servosrc buffer size to {}", size,);
- self.sender
- .send(ServoSrcMsg::Resize(size))
- .map_err(|_| gst_loggable_error!(CATEGORY, "Failed to send video info"))?;
*self.info.lock().unwrap() = Some(info);
Ok(())
}
@@ -534,6 +529,7 @@ impl BaseSrcImpl for ServoSrc {
})?;
let height = frame.height() as i32;
let width = frame.width() as i32;
+ let size = Size2D::new(width, height);
let format = frame.format();
debug!(
"Filling servosrc buffer {}x{} {:?} {:?}",
@@ -545,6 +541,13 @@ impl BaseSrcImpl for ServoSrc {
let mut gfx = gfx.borrow_mut();
let gfx = &mut *gfx;
if let Some(surface) = self.swap_chain.take_surface() {
+ let surface_size = Size2D::from_untyped(gfx.device.surface_info(&surface).size);
+ if size != surface_size {
+ // If we're being asked to fill frames that are a different size than servo is providing,
+ // ask it to change size.
+ let _ = self.sender.send(ServoSrcMsg::Resize(size));
+ }
+
gfx.device.make_context_current(&gfx.context).unwrap();
debug_assert_eq!(
(