Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

Negotiate GL textures and render them in player example - #182

Merged
bors-servo merged 15 commits into
servo:masterfrom
ceyusa:gl-textures
Feb 21, 2019
Merged

bors-servo merged 15 commits into
servo:masterfrom
ceyusa:gl-textures

Conversation

@ceyusa

@ceyusa ceyusa commented Jan 23, 2019 •

Copy link
Copy Markdown
Contributor

This PR goes above PR #196

It needs to update the CI GStreamer setup, because it requires a new version of glib and gstreamer-gl library.

It contains

  • Port to webrender 0.58
  • Port to gstreamer git head version (0.13.0) -- this implied a complete rewrite of servosrc
  • Add a new trait in Frame to hold a reference to the backend's buffer
  • Update glutin version tu current git head
  • Add a method to set the GL parameters in the backend's player
  • Use glsinkbin in gstreamer player in GL parameters are negotiated
  • A lot of changes in example player to render gl textures is --gl argument is passed

Fixes: #166

Comment thread backends/gstreamer/src/audio_decoder.rs Resolved
Comment thread backends/gstreamer/src/source.rs Resolved
Comment thread backends/gstreamer/src/source.rs Resolved
Comment thread backends/gstreamer/src/source.rs Resolved
Comment thread backends/gstreamer/src/source.rs Resolved
Comment thread backends/gstreamer/src/source.rs Resolved
@ceyusa
ceyusa force-pushed the gl-textures branch 2 times, most recently from 8914c53 to 250e0a8 Compare January 28, 2019 15:02
@ceyusa

ceyusa commented Jan 28, 2019

Copy link
Copy Markdown
Contributor Author

Right now, WebRTC GStreamer backend doesn't compile: there are multiple errors of this type

error[E0623]: lifetime mismatch                                                                                                                                                                                    
  --> backends/gstreamer/src/media_capture.rs:20:36                                                                                                                                                                
   |                                                                                                                                                                                                               
17 |         builder: gst::caps::Builder,                                                                                                                                                                          
   |                  ------------------ this parameter and the return type are declared with different lifetimes...                                                                                               
18 |     ) -> Option<gst::caps::Builder> {                                                                                                                                                                         
   |          --------------------------                                                                                                                                                                           
19 |         match self {                                                                                                                                                                                          
20 |             Constrain::Value(v) => Some(builder.field(name, v)),                                                                                                                                              
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `builder` is returned here                                                                                                   
                                                                                                                     

Comment thread backends/gstreamer/src/media_capture.rs Resolved
@ceyusa
ceyusa force-pushed the gl-textures branch 6 times, most recently from ec686bc to 503940a Compare January 31, 2019 16:57
@ceyusa

ceyusa commented Feb 5, 2019

Copy link
Copy Markdown
Contributor Author

Last Friday I confirmed my suspicion that the media's frame should keep a living reference to the associated GStreamer buffer, otherwise the buffer gets unreffed and the texture turns invalid.

Since media's frame is backend's agnostic, it would be hard to keep a reference to a opaque structure, so I tried out to turn frame into a trait.

But soon I got hit by FrameRenderer trait, which function render() receives a Frame, which now turned into a trait, FrameRenderer violates the rules of trait object safety. And I'm kind of trapped there.

@ceyusa ceyusa changed the title WIP: GL textures Negotiate GL textures and render them in player example Feb 8, 2019
@ceyusa
ceyusa force-pushed the gl-textures branch 4 times, most recently from 8da43f7 to 36c0488 Compare February 13, 2019 17:43
@ceyusa

ceyusa commented Feb 13, 2019

Copy link
Copy Markdown
Contributor Author

@ferjm @jdm r?

@ferjm ferjm left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you so much for doing this work.

As mentioned on IRC, we need to figure out the codepath for OSX before being able to merge this.

I'd love to hear @sdroege final feedback as well :)

Comment thread backends/gstreamer/src/source.rs Resolved
Comment thread backends/gstreamer/src/player.rs Resolved
Comment thread backends/gstreamer/src/player.rs Resolved
Comment thread backends/gstreamer/src/player.rs Resolved
@sdroege

sdroege commented Feb 14, 2019

Copy link
Copy Markdown
Contributor

I'd love to hear @sdroege final feedback as well :)

Won't get to that today but I'll put it on my list.

@ceyusa
ceyusa force-pushed the gl-textures branch 2 times, most recently from 5fd9fb1 to 67ec36c Compare February 14, 2019 17:20
Comment thread backends/gstreamer/Cargo.toml Resolved
This implies

* to use glib::GString for media_info data
* gst::Buffer::from_slice() doesn't fail
* New returns as Result simplifyng code
* Rewrite ServoSrc element using subclassing
* add life times to media_capture caps builder
* enable NLL for gstreamer crate
For programming errors it is better to panic using expect(). This
patch does this for GObject's set_property and get_property.
And implement it in GStreamer backend. The purpose of this trait is to
keep alive the reference of the backend's buffer while it is used.
Since the current unreleased version has merged the required API to
get the used EGL Display.
The purpose of this argument is to select if the user wants to
render textures or images.

*This is just a mock up*, textures are not handled yet.
Move upper the player_wrapper instantiation in order to set the gl
usage as soon as possible.
If buffer contains a GL texture it will return the texture id
If gl display and context are set, the glsinkbin is used,
otherwise only appsink.

Now GL textures are negotiated and rendered.
@ceyusa

ceyusa commented Feb 20, 2019

Copy link
Copy Markdown
Contributor Author

I guess all (or most of) the issues were solved :)

@sdroege

sdroege commented Feb 20, 2019

Copy link
Copy Markdown
Contributor

I guess all (or most of) the issues were solved :)

🎊 Nothing else from my side, I guess :)

@ferjm

ferjm commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

@bors-servo r+

@Manishearth

Copy link
Copy Markdown
Member

@bors-servo r=ferjm

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 6a3be48 has been approved by ferjm

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 6a3be48 with merge 888668f...

bors-servo pushed a commit that referenced this pull request Feb 21, 2019
Negotiate  GL textures and render them in player example

This PR goes above PR #196

It needs to update the CI GStreamer setup, because it requires  a new version of glib and gstreamer-gl library.

It contains

* Port to webrender 0.58
* Port to gstreamer git head version (0.13.0) -- this implied a complete rewrite of servosrc
* Add a new trait in Frame to hold a reference to the backend's buffer
* Update glutin version tu current git head
* Add a method to set the GL parameters in the backend's player
* Use glsinkbin in gstreamer player in GL parameters are negotiated
* A lot of changes in example player to render gl textures is --gl argument is passed

Fixes: #166
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-travis
Approved by: ferjm
Pushing 888668f to master...

@bors-servo
bors-servo merged commit 6a3be48 into servo:master Feb 21, 2019
@ceyusa
ceyusa deleted the gl-textures branch April 19, 2019 18:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants