Set have_metadata for audio elements too

We don't store video-specific metadata anymore, and we don't ignore audio-specific
metadata anymore. We now just acknowledge that we received some metadata.
This commit is contained in:
Anthony Ramine 2017-10-04 11:14:01 +02:00
parent 77afc3f33a
commit b8c55e7da6
32 changed files with 6 additions and 198 deletions

View file

@ -79,9 +79,6 @@ pub struct HTMLMediaElement {
/// Play promises which are soon to be fulfilled by a queued task.
#[ignore_heap_size_of = "promises are hard"]
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
/// The details of the video currently related to this media element.
// FIXME(nox): Why isn't this in HTMLVideoElement?
video: DomRefCell<Option<VideoMedia>>,
}
/// https://html.spec.whatwg.org/multipage/#dom-media-networkstate
@ -105,17 +102,6 @@ enum ReadyState {
HaveEnoughData = HTMLMediaElementConstants::HAVE_ENOUGH_DATA as u8,
}
#[derive(HeapSizeOf, JSTraceable)]
pub struct VideoMedia {
format: String,
#[ignore_heap_size_of = "defined in time"]
duration: Duration,
width: u32,
height: u32,
video: String,
audio: Option<String>,
}
impl HTMLMediaElement {
pub fn new_inherited(
tag_name: LocalName,
@ -136,7 +122,6 @@ impl HTMLMediaElement {
delaying_the_load_event_flag: Default::default(),
pending_play_promises: Default::default(),
in_flight_play_promises_queue: Default::default(),
video: DomRefCell::new(None),
}
}
@ -1111,23 +1096,10 @@ impl HTMLMediaElementContext {
}
fn check_metadata(&mut self, elem: &HTMLMediaElement) {
match audio_video_metadata::get_format_from_slice(&self.data) {
Ok(audio_video_metadata::Metadata::Video(meta)) => {
let dur = meta.audio.duration.unwrap_or(::std::time::Duration::new(0, 0));
*elem.video.borrow_mut() = Some(VideoMedia {
format: format!("{:?}", meta.format),
duration: Duration::seconds(dur.as_secs() as i64) +
Duration::nanoseconds(dur.subsec_nanos() as i64),
width: meta.dimensions.width,
height: meta.dimensions.height,
video: meta.video.unwrap_or("".to_owned()),
audio: meta.audio.audio,
});
// Step 6
elem.change_ready_state(ReadyState::HaveMetadata);
self.have_metadata = true;
}
_ => {}
if audio_video_metadata::get_format_from_slice(&self.data).is_ok() {
// Step 6.
elem.change_ready_state(ReadyState::HaveMetadata);
self.have_metadata = true;
}
}
}

View file

@ -1,5 +1,6 @@
[audio_loop_base.html]
type: testharness
disabled: extreme timeout
[Check if audio.loop is set to true that expecting the seeking event is fired more than once]
expected: FAIL

View file

@ -1,8 +1,5 @@
[error.html]
type: testharness
[audio.error after successful load]
expected: FAIL
[audio.error after setting src to the empty string]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_canplay.html]
type: testharness
[setting src attribute on autoplay audio should trigger canplay event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_canplay_noautoplay.html]
type: testharness
[setting src attribute on non-autoplay audio should trigger canplay event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_canplaythrough.html]
type: testharness
[setting src attribute on autoplay audio should trigger canplaythrough event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_canplaythrough_noautoplay.html]
type: testharness
[setting src attribute on non-autoplay audio should trigger canplaythrough event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_loadeddata.html]
type: testharness
[setting src attribute on autoplay audio should trigger loadeddata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_loadeddata_noautoplay.html]
type: testharness
[setting src attribute on non-autoplay audio should trigger loadeddata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_loadedmetadata.html]
type: testharness
[setting src attribute on autoplay audio should trigger loadedmetadata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_loadedmetadata_noautoplay.html]
type: testharness
[setting src attribute on non-autoplay audio should trigger loadedmetadata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_order_canplay_canplaythrough.html]
type: testharness
[setting src attribute on autoplay audio should trigger canplay then canplaythrough event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_order_canplay_playing.html]
type: testharness
[setting src attribute on autoplay audio should trigger canplay then playing event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_order_loadedmetadata_loadeddata.html]
type: testharness
[setting src attribute on autoplay audio should trigger loadedmetadata then loadeddata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_order_loadstart_progress.html]
type: testharness
[setting src attribute on autoplay audio should trigger loadstart then progress event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_pause.html]
type: testharness
[calling pause() on autoplay audio should trigger pause event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_play.html]
type: testharness
[setting src attribute on autoplay audio should trigger play event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_playing.html]
type: testharness
[setting src attribute on autoplay audio should trigger playing event]
expected: FAIL

View file

@ -1,6 +0,0 @@
[event_playing_noautoplay.html]
type: testharness
expected: TIMEOUT
[calling play() on audio should trigger playing event]
expected: NOTRUN

View file

@ -1,5 +0,0 @@
[event_progress.html]
type: testharness
[setting src attribute on autoplay audio should trigger progress event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[event_progress_noautoplay.html]
type: testharness
[setting src attribute on non-autoplay audio should trigger progress event]
expected: FAIL

View file

@ -2,7 +2,7 @@
type: testharness
expected: TIMEOUT
[calling play() on a sufficiently long audio should trigger timeupdate event]
expected: FAIL
expected: NOTRUN
[calling play() on a sufficiently long video should trigger timeupdate event]
expected: NOTRUN

View file

@ -1,14 +0,0 @@
[autoplay-overrides-preload.html]
type: testharness
[autoplay (set first) overrides preload "none"]
expected: FAIL
[autoplay (set last) overrides preload "none"]
expected: FAIL
[autoplay (set first) overrides preload "metadata"]
expected: FAIL
[autoplay (set last) overrides preload "metadata"]
expected: FAIL

View file

@ -1,5 +0,0 @@
[load-events-networkState.html]
type: testharness
[NETWORK_IDLE]
expected: FAIL

View file

@ -1,5 +0,0 @@
[networkState_during_progress.html]
type: testharness
[audioElement.networkState should be NETWORK_LOADING during progress event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[paused_false_during_play.html]
type: testharness
[audio.paused should be false during play event]
expected: FAIL

View file

@ -1,17 +0,0 @@
[autoplay.html]
type: testharness
[audio.autoplay]
expected: FAIL
[audio.autoplay and load()]
expected: FAIL
[audio.autoplay and play()]
expected: FAIL
[audio.autoplay and pause()]
expected: FAIL
[audio.autoplay and internal pause steps]
expected: FAIL

View file

@ -1,5 +0,0 @@
[readyState_during_canplay.html]
type: testharness
[audio.readyState should be >= HAVE_FUTURE_DATA during canplay event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[readyState_during_canplaythrough.html]
type: testharness
[audio.readyState should be HAVE_ENOUGH_DATA during canplaythrough event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[readyState_during_loadeddata.html]
type: testharness
[audio.readyState should be >= HAVE_CURRENT_DATA during loadeddata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[readyState_during_loadedmetadata.html]
type: testharness
[audio.readyState should be >= HAVE_METADATA during loadedmetadata event]
expected: FAIL

View file

@ -1,5 +0,0 @@
[readyState_during_playing.html]
type: testharness
[audio.readyState should be >= HAVE_FUTURE_DATA during playing event]
expected: FAIL