Use servo-media-auto and call ServoMedia::init where required

This commit is contained in:
Fernando Jiménez Moreno 2019-03-12 12:46:56 +01:00
parent 36825b82f3
commit bc74dc0e85
6 changed files with 493 additions and 0 deletions

View file

@ -96,6 +96,7 @@ servo_atoms = {path = "../atoms"}
servo_config = {path = "../config"}
servo_geometry = {path = "../geometry" }
servo-media = {git = "https://github.com/servo/media"}
servo-media-auto = {git = "https://github.com/servo/media"}
servo_rand = {path = "../rand"}
servo_url = {path = "../url"}
smallvec = { version = "0.6", features = ["std", "union"] }

View file

@ -51,6 +51,7 @@ use servo_media::audio::context::{OfflineAudioContextOptions, RealTimeAudioConte
use servo_media::audio::decoder::AudioDecoderCallbacks;
use servo_media::audio::graph::NodeId;
use servo_media::ServoMedia;
use servo_media_auto::Backend;
use std::cell::Cell;
use std::collections::{HashMap, VecDeque};
use std::mem;
@ -108,6 +109,8 @@ impl BaseAudioContext {
},
};
ServoMedia::init::<Backend>();
let context = BaseAudioContext {
eventtarget: EventTarget::new_inherited(),
audio_context_impl: ServoMedia::get()

View file

@ -68,6 +68,7 @@ use servo_config::pref;
use servo_media::player::frame::{Frame, FrameRenderer};
use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, StreamType};
use servo_media::ServoMedia;
use servo_media_auto::Backend;
use servo_url::ServoUrl;
use std::cell::Cell;
use std::collections::VecDeque;
@ -249,6 +250,7 @@ pub enum ReadyState {
impl HTMLMediaElement {
pub fn new_inherited(tag_name: LocalName, prefix: Option<Prefix>, document: &Document) -> Self {
ServoMedia::init::<Backend>();
Self {
htmlelement: HTMLElement::new_inherited(tag_name, prefix, document),
network_state: Cell::new(NetworkState::Empty),

View file

@ -17,6 +17,7 @@ use crate::dom::promise::Promise;
use dom_struct::dom_struct;
use servo_media::streams::capture::{Constrain, ConstrainRange, MediaTrackConstraintSet};
use servo_media::ServoMedia;
use servo_media_auto::Backend;
use std::rc::Rc;
#[dom_struct]
@ -26,6 +27,7 @@ pub struct MediaDevices {
impl MediaDevices {
pub fn new_inherited() -> MediaDevices {
ServoMedia::init::<Backend>();
MediaDevices {
eventtarget: EventTarget::new_inherited(),
}

View file

@ -39,6 +39,7 @@ use servo_media::webrtc::{
BundlePolicy, IceCandidate, SdpType, SessionDescription, WebRtcController, WebRtcSignaller,
};
use servo_media::ServoMedia;
use servo_media_auto::Backend;
use std::cell::Cell;
use std::rc::Rc;
@ -117,6 +118,7 @@ impl RTCPeerConnection {
RTCPeerConnectionBinding::Wrap,
);
let signaller = this.make_signaller();
ServoMedia::init::<Backend>();
*this.controller.borrow_mut() = Some(ServoMedia::get().unwrap().create_webrtc(signaller));
if let Some(ref servers) = config.iceServers {
if let Some(ref server) = servers.get(0) {