mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Fix HAVE_METADATA and HAVE_CURRENT_DATA state transitions
This commit is contained in:
parent
dba61ad1df
commit
1c92240310
2 changed files with 43 additions and 33 deletions
|
@ -510,6 +510,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-media-load-algorithm
|
||||
fn invoke_resource_selection_algorithm(&self) {
|
||||
println!("invoke_resource_selection_algorithm");
|
||||
// Step 1.
|
||||
self.network_state.set(NetworkState::NoSource);
|
||||
|
||||
|
@ -541,6 +542,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-media-load-algorithm
|
||||
fn resource_selection_algorithm_sync(&self, base_url: ServoUrl) {
|
||||
println!("resource_selection_algorithm_sync");
|
||||
// Step 5.
|
||||
// FIXME(ferjm): Implement blocked_on_parser logic
|
||||
// https://html.spec.whatwg.org/multipage/#blocked-on-parser
|
||||
|
@ -641,6 +643,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-media-load-resource
|
||||
fn resource_fetch_algorithm(&self, resource: Resource) {
|
||||
println!("resource_fetch_algorithm");
|
||||
// Steps 1-2.
|
||||
// Unapplicable, the `resource` variable already conveys which mode
|
||||
// is in use.
|
||||
|
@ -706,7 +709,9 @@ impl HTMLMediaElement {
|
|||
..RequestInit::default()
|
||||
};
|
||||
|
||||
println!("Setting up media player");
|
||||
self.setup_media_player();
|
||||
println!("Media player setup");
|
||||
let context = Arc::new(Mutex::new(HTMLMediaElementContext::new(self)));
|
||||
let (action_sender, action_receiver) = ipc::channel().unwrap();
|
||||
let window = window_from_node(self);
|
||||
|
@ -790,6 +795,7 @@ impl HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#media-element-load-algorithm
|
||||
fn media_element_load_algorithm(&self) {
|
||||
println!("media_element_load_algorithm");
|
||||
// Reset the flag that signals whether loadeddata was ever fired for
|
||||
// this invokation of the load algorithm.
|
||||
self.fired_loadeddata_event.set(false);
|
||||
|
@ -969,7 +975,7 @@ impl HTMLMediaElement {
|
|||
fn handle_player_event(&self, event: &PlayerEvent) {
|
||||
match *event {
|
||||
PlayerEvent::MetadataUpdated(ref metadata) => {
|
||||
if !self.have_metadata.get() && metadata.duration.is_some() {
|
||||
println!("PlayerEvent::MetadataUpdated");
|
||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||
// => "Once enough of the media data has been fetched to determine the duration..."
|
||||
// Step 1.
|
||||
|
@ -1005,10 +1011,6 @@ impl HTMLMediaElement {
|
|||
self.have_metadata.set(true);
|
||||
|
||||
// XXX(ferjm) Steps 7 to 13.
|
||||
} else {
|
||||
// => set the element's delaying-the-load-event flag to false
|
||||
self.change_ready_state(ReadyState::HaveCurrentData);
|
||||
}
|
||||
},
|
||||
PlayerEvent::StateChanged(ref state) => match *state {
|
||||
PlaybackState::Paused => {
|
||||
|
@ -1274,6 +1276,13 @@ impl FetchResponseListener for HTMLMediaElementContext {
|
|||
return;
|
||||
}
|
||||
|
||||
// Make sure we don't skip the HaveMetadata state.
|
||||
if elem.have_metadata.get() {
|
||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||
// => set the element's delaying-the-load-event flag to false
|
||||
elem.change_ready_state(ReadyState::HaveCurrentData);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-media-load-resource step 4,
|
||||
// => "If mode is remote" step 2
|
||||
if time::get_time() > self.next_progress_event {
|
||||
|
|
|
@ -3,6 +3,7 @@ env:
|
|||
RUSTFLAGS: -Dwarnings
|
||||
CARGO_INCREMENTAL: "0"
|
||||
SCCACHE_IDLE_TIMEOUT: "1200"
|
||||
GST_DEBUG: '3'
|
||||
|
||||
mac-rel-wpt1:
|
||||
- ./mach clean-nightlies --keep 3 --force
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue