Skip to content

Commit

Permalink
Update Player instantiator API
Browse files Browse the repository at this point in the history
Now servo/media player requires a new parameter for its creator, which
is a trait object that provides the GL parameters needed for setup the
generation of frames as GL textures.

This patch provides a dummy GL context trait object where the code
path will go to the default of raw frames.

Webaudio test expectation also were changed, adding two new failing
tests.
  • Loading branch information
ceyusa committed May 2, 2019
1 parent 834d319 commit f9bee36
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion components/script/dom/htmlmediaelement.rs
Expand Up @@ -70,6 +70,7 @@ use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FetchResponseLis
use net_traits::{NetworkError, ResourceFetchTiming, ResourceTimingType};
use script_layout_interface::HTMLMediaData;
use servo_config::pref;
use servo_media::player::context::{GlContext, NativeDisplay, PlayerGLContext};
use servo_media::player::frame::{Frame, FrameRenderer};
use servo_media::player::{PlaybackState, Player, PlayerError, PlayerEvent, StreamType};
use servo_media::ServoMedia;
Expand Down Expand Up @@ -160,6 +161,16 @@ impl FrameRenderer for MediaFrameRenderer {
}
}

struct PlayerContextDummy();
impl PlayerGLContext for PlayerContextDummy {
fn get_gl_context(&self) -> GlContext {
return GlContext::Unknown;
}
fn get_native_display(&self) -> NativeDisplay {
return NativeDisplay::Unknown;
}
}

#[must_root]
#[derive(JSTraceable, MallocSizeOf)]
enum SrcObject {
Expand Down Expand Up @@ -1201,7 +1212,9 @@ impl HTMLMediaElement {
_ => StreamType::Seekable,
};

let player = ServoMedia::get().unwrap().create_player(stream_type);
let player = ServoMedia::get()
.unwrap()
.create_player(stream_type, Box::new(PlayerContextDummy()));

let (action_sender, action_receiver) = ipc::channel().unwrap();
player.register_event_handler(action_sender);
Expand Down
Expand Up @@ -11,3 +11,9 @@
[X SNR (-0.5698 dB) is not greater than or equal to 37.17. Got -0.5697716379745515.]
expected: FAIL

[X Interpolated sine wave does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...\] with an element-wise tolerance of {"absoluteThreshold":0.090348,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[1\]\t3.3873793482780457e-1\t0.0000000000000000e+0\t3.3873793482780457e-1\tInfinity\t9.0347999999999998e-2\n\t[2\]\t6.3742399215698242e-1\t0.0000000000000000e+0\t6.3742399215698242e-1\tInfinity\t9.0347999999999998e-2\n\t[3\]\t8.6074203252792358e-1\t0.0000000000000000e+0\t8.6074203252792358e-1\tInfinity\t9.0347999999999998e-2\n\t[4\]\t9.8228722810745239e-1\t0.0000000000000000e+0\t9.8228722810745239e-1\tInfinity\t9.0347999999999998e-2\n\t[5\]\t9.8768836259841919e-1\t0.0000000000000000e+0\t9.8768836259841919e-1\tInfinity\t9.0347999999999998e-2\n\t...and 81 more errors.\n\tMax AbsError of 1.0000000000000000e+0 at index of 200.\n\t[200\]\t-1.0000000000000000e+0\t0.0000000000000000e+0\t1.0000000000000000e+0\tInfinity\t9.0347999999999998e-2\n\tMax RelError of Infinity at index of 1.\n]
expected: FAIL

[X SNR (-Infinity dB) is not greater than or equal to 37.17. Got -Infinity.]
expected: FAIL

Expand Up @@ -26,3 +26,9 @@
[# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.]
expected: FAIL

[< [invalid-operation\] 1 out of 4 assertions were failed.]
expected: FAIL

[X The gain value of the second gain node is not equal to 0.5. Got 1.]
expected: FAIL

Expand Up @@ -17,3 +17,9 @@
[X Osc(freq: 44100.00390625) output: Expected 0 for all values but found 5511 unexpected values: \n\tIndex\tActual\n\t[1\]\t5.565462970480439e-7\n\t[2\]\t0.0000011130925940960879\n\t[3\]\t0.0000016696390048309695\n\t[4\]\t0.0000022261851881921757\n\t...and 5507 more errors.]
expected: FAIL

[# AUDIT TASK RUNNER FINISHED: 1 out of 2 tasks were failed.]
expected: FAIL

[X osc[0:4\] should have contain at least one value different from 0.]
expected: FAIL

0 comments on commit f9bee36

Please sign in to comment.