mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
libservo: Move GL acclerated media setup out of RenderingContext
and simplify it (#35553)
This moves the GL accelerated media setup out of `RenderingContext` which prevents making libservo dependo on the Wayland and X11 versions of surfman explicitly. This support is experimental and (honestly) a bit broken. I've confirmed that this works as well as it did before the change. The main thing here is that the configuration, which currently needs surfman types, moves to servoshell. In addition: 1. Instead of passing the information to the Constellation, the setup is stored statically. This is necessary to avoid introducing a dependency on `media` in `webrender_traits`. It's quite likely that `media` types should move to the internal embedding API to avoid this. This is preserved for a followup change. 2. The whole system of wrapping the media channels in an abstract type is removed. They could be either mpsc channels or IPC channels. This was never going to work because mpsc channels cannot be serialized and deserialized with serde. Instead this just uses IPC channels. We also have other ways of doing this kind of abstraction in Servo so we do not need another. The `mpsc` version was hard-coded to be disabled. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
9887ad369d
commit
5465bfc2af
15 changed files with 226 additions and 469 deletions
|
@ -17,10 +17,10 @@ use headers::{ContentLength, ContentRange, HeaderMapExt};
|
|||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use http::header::{self, HeaderMap, HeaderValue};
|
||||
use http::StatusCode;
|
||||
use ipc_channel::ipc::{self, IpcSharedMemory};
|
||||
use ipc_channel::ipc::{self, channel, IpcSharedMemory};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsapi::JSAutoRealm;
|
||||
use media::{glplayer_channel, GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
|
||||
use media::{GLPlayerMsg, GLPlayerMsgForward, WindowGLContext};
|
||||
use net_traits::request::{Destination, RequestId};
|
||||
use net_traits::{
|
||||
FetchMetadata, FetchResponseListener, Metadata, NetworkError, ResourceFetchTiming,
|
||||
|
@ -1399,12 +1399,10 @@ impl HTMLMediaElement {
|
|||
// GLPlayer thread setup
|
||||
let (player_id, image_receiver) = window
|
||||
.get_player_context()
|
||||
.glplayer_chan
|
||||
.glplayer_thread_sender
|
||||
.map(|pipeline| {
|
||||
let (image_sender, image_receiver) =
|
||||
glplayer_channel::<GLPlayerMsgForward>().unwrap();
|
||||
let (image_sender, image_receiver) = channel().unwrap();
|
||||
pipeline
|
||||
.channel()
|
||||
.send(GLPlayerMsg::RegisterPlayer(image_sender))
|
||||
.unwrap();
|
||||
match image_receiver.recv().unwrap() {
|
||||
|
@ -1425,7 +1423,7 @@ impl HTMLMediaElement {
|
|||
.media_element_task_source()
|
||||
.to_sendable();
|
||||
ROUTER.add_typed_route(
|
||||
image_receiver.to_ipc_receiver(),
|
||||
image_receiver,
|
||||
Box::new(move |message| {
|
||||
let msg = message.unwrap();
|
||||
let this = trusted_node.clone();
|
||||
|
@ -2051,14 +2049,8 @@ impl HTMLMediaElement {
|
|||
|
||||
impl Drop for HTMLMediaElement {
|
||||
fn drop(&mut self) {
|
||||
if let Some(ref pipeline) = self.player_context.glplayer_chan {
|
||||
if let Err(err) = pipeline
|
||||
.channel()
|
||||
.send(GLPlayerMsg::UnregisterPlayer(self.id.get()))
|
||||
{
|
||||
warn!("GLPlayer disappeared!: {:?}", err);
|
||||
}
|
||||
}
|
||||
self.player_context
|
||||
.send(GLPlayerMsg::UnregisterPlayer(self.id.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue