mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Move closing of incremental media streams to the fetch cancel
This should ensure that the close() happens in all cases where the fetch completion may not occur otherwise.
This commit is contained in:
committed by
Alexander Kalenik
parent
8208d6f3c5
commit
a19c40aac5
Notes:
github-actions[bot]
2026-04-08 11:04:44 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a19c40aac5e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8812
@@ -262,6 +262,8 @@ void HTMLMediaElement::removed_from(DOM::Node* old_parent, DOM::Node& old_root)
|
||||
void HTMLMediaElement::cancel_the_fetching_process()
|
||||
{
|
||||
m_current_fetch_generation++;
|
||||
if (m_remote_fetch_data && m_remote_fetch_data->stream)
|
||||
m_remote_fetch_data->stream->close();
|
||||
m_remote_fetch_data.clear();
|
||||
}
|
||||
|
||||
@@ -1172,11 +1174,7 @@ void HTMLMediaElement::load_url_resource(URL::URL const& url_record, Function<vo
|
||||
m_remote_fetch_data->stream->set_data_request_callback(GC::weak_callback(*this, [&fetch_data = *m_remote_fetch_data](auto& self, u64 offset) {
|
||||
self.restart_fetch_at_offset(offset);
|
||||
}));
|
||||
m_remote_fetch_data->failure_callback = [&stream = *m_remote_fetch_data->stream, failure_callback = move(failure_callback)](String error_message) {
|
||||
// Ensure that we unblock any reads if we stop the fetch due to some failure.
|
||||
stream.close();
|
||||
failure_callback(move(error_message));
|
||||
};
|
||||
m_remote_fetch_data->failure_callback = move(failure_callback);
|
||||
|
||||
set_up_playback_manager_for_remote();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user