mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Do not move to HaveEnoughData state if no media data is fetched from the network
This commit is contained in:
parent
707b490c0f
commit
8818898240
5 changed files with 8 additions and 20 deletions
|
@ -1528,6 +1528,8 @@ struct HTMLMediaElementContext {
|
||||||
resource_timing: ResourceFetchTiming,
|
resource_timing: ResourceFetchTiming,
|
||||||
/// url for the resource
|
/// url for the resource
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
|
/// Amount of data fetched.
|
||||||
|
bytes_fetched: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||||
|
@ -1592,8 +1594,9 @@ impl FetchResponseListener for HTMLMediaElementContext {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let elem = self.elem.root();
|
self.bytes_fetched += payload.len();
|
||||||
|
|
||||||
|
let elem = self.elem.root();
|
||||||
// Push input data into the player.
|
// Push input data into the player.
|
||||||
if let Err(e) = elem.player.push_data(payload) {
|
if let Err(e) = elem.player.push_data(payload) {
|
||||||
eprintln!("Could not push input data to player {:?}", e);
|
eprintln!("Could not push input data to player {:?}", e);
|
||||||
|
@ -1617,14 +1620,14 @@ impl FetchResponseListener for HTMLMediaElementContext {
|
||||||
let elem = self.elem.root();
|
let elem = self.elem.root();
|
||||||
if self.ignore_response {
|
if self.ignore_response {
|
||||||
// An error was received previously, skip processing the payload
|
// An error was received previously, skip processing the payload
|
||||||
// and notify the media backend that we are done pushing data.
|
// and notify the media backend that we are done pushing data.
|
||||||
if let Err(e) = elem.player.end_of_stream() {
|
if let Err(e) = elem.player.end_of_stream() {
|
||||||
warn!("Could not signal EOS to player {:?}", e);
|
warn!("Could not signal EOS to player {:?}", e);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if status.is_ok() {
|
if status.is_ok() && self.bytes_fetched != 0 {
|
||||||
if elem.ready_state.get() == ReadyState::HaveNothing {
|
if elem.ready_state.get() == ReadyState::HaveNothing {
|
||||||
// Make sure that we don't skip the HaveMetadata and HaveCurrentData
|
// Make sure that we don't skip the HaveMetadata and HaveCurrentData
|
||||||
// states for short streams.
|
// states for short streams.
|
||||||
|
@ -1711,7 +1714,8 @@ impl HTMLMediaElementContext {
|
||||||
next_progress_event: time::get_time() + Duration::milliseconds(350),
|
next_progress_event: time::get_time() + Duration::milliseconds(350),
|
||||||
ignore_response: false,
|
ignore_response: false,
|
||||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||||
url: url,
|
url,
|
||||||
|
bytes_fetched: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[load-events-networkState.html]
|
|
||||||
[NETWORK_NO_SOURCE]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[resource-selection-invoke-insert-into-iframe.html]
|
|
||||||
[NOT invoking resource selection by inserting into other document with src set]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[resource-selection-invoke-pause-networkState.html]
|
|
||||||
[NOT invoking resource selection with pause() when networkState is not NETWORK_EMPTY]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[resource-selection-invoke-remove-from-document-networkState.html]
|
|
||||||
[NOT invoking resource selection with implicit pause() when networkState is not NETWORK_EMPTY]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue