From 3d3a86d2e1d26f2c30e1b83e45bafa8d995ea1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Tue, 4 Sep 2018 09:37:29 +0200 Subject: [PATCH] Clarify some FIXMEs and bail out if we fail pushing data to player --- components/script/dom/htmlmediaelement.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index fbf0882e045b..5feffc2ecc60 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -620,7 +620,7 @@ impl HTMLMediaElement { }, Mode::Children(_source) => { // Step 9.children. - // FIXME(victor): seems not implemeted yet + // FIXME: https://github.com/servo/servo/issues/21481 self.queue_dedicated_media_source_failure_steps() }, } @@ -1193,9 +1193,10 @@ impl FetchResponseListener for HTMLMediaElementContext { let elem = self.elem.root(); - // push input data into the player + // Push input data into the player. if let Err(_) = elem.player.push_data(payload) { eprintln!("Couldn't push input data to player"); + return; } // https://html.spec.whatwg.org/multipage/#concept-media-load-resource step 4, @@ -1219,7 +1220,7 @@ impl FetchResponseListener for HTMLMediaElementContext { } let elem = self.elem.root(); - // signal the eos to player + // Signal the eos to player. if let Err(_) = elem.player.end_of_stream() { eprintln!("Couldn't signal EOS to player"); } @@ -1227,9 +1228,17 @@ impl FetchResponseListener for HTMLMediaElementContext { // => "If the media data can be fetched but is found by inspection to be in an unsupported // format, or can otherwise not be rendered at all" if !elem.have_metadata.get() { - // FIXME(victor): adjust player's max-size (or buffering) + // FIXME(victor): adjust player's max-size (or buffering). + // + // In short streams the EOS might arrive before extracting the stream + // metadata. This is because the internal queue in the GStreamer appsrc element, + // has a size of 200K and it pushes the data until it is reached. It would be nice + // to add a property to set the max-data in appsrc according to reported size of + // the stream. + // Until then, we comment out the failure steps. + // //elem.queue_dedicated_media_source_failure_steps(); - // => "Once the entire media resource has been fetched..." + // => "Once the entire media resource has been fetched..." } else if status.is_ok() { elem.change_ready_state(ReadyState::HaveEnoughData);