mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Move 'queue a media element task' to BaseAudioContext
We need these steps to be available for the yet to be implemented `BaseAudioContext.decodeAudioData()`.
This commit is contained in:
committed by
Andreas Kling
parent
273a46cc76
commit
177e5210e0
@@ -298,12 +298,6 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> AudioContext::close()
|
|||||||
return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise->promise()) };
|
return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise->promise()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioContext::queue_a_media_element_task(Function<void()> steps)
|
|
||||||
{
|
|
||||||
auto task = HTML::Task::create(vm(), m_media_element_event_task_source.source, HTML::current_settings_object().responsible_document(), JS::create_heap_function(heap(), move(steps)));
|
|
||||||
HTML::main_thread_event_loop().task_queue().add(move(task));
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Actually implement the rendering thread
|
// FIXME: Actually implement the rendering thread
|
||||||
bool AudioContext::start_rendering_audio_graph()
|
bool AudioContext::start_rendering_audio_graph()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,9 +52,7 @@ private:
|
|||||||
Vector<JS::NonnullGCPtr<WebIDL::Promise>> m_pending_promises;
|
Vector<JS::NonnullGCPtr<WebIDL::Promise>> m_pending_promises;
|
||||||
Vector<JS::NonnullGCPtr<WebIDL::Promise>> m_pending_resume_promises;
|
Vector<JS::NonnullGCPtr<WebIDL::Promise>> m_pending_resume_promises;
|
||||||
bool m_suspended_by_user = false;
|
bool m_suspended_by_user = false;
|
||||||
HTML::UniqueTaskSource m_media_element_event_task_source {};
|
|
||||||
|
|
||||||
void queue_a_media_element_task(Function<void()> steps);
|
|
||||||
bool start_rendering_audio_graph();
|
bool start_rendering_audio_graph();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
||||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||||
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@@ -113,4 +114,10 @@ WebIDL::ExceptionOr<void> BaseAudioContext::verify_audio_options_inside_nominal_
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseAudioContext::queue_a_media_element_task(Function<void()> steps)
|
||||||
|
{
|
||||||
|
auto task = HTML::Task::create(vm(), m_media_element_event_task_source.source, HTML::current_settings_object().responsible_document(), JS::create_heap_function(heap(), move(steps)));
|
||||||
|
HTML::main_thread_event_loop().task_queue().add(move(task));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
* Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
|
||||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||||
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@@ -61,17 +62,21 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
explicit BaseAudioContext(JS::Realm&, float m_sample_rate = 0);
|
explicit BaseAudioContext(JS::Realm&, float m_sample_rate = 0);
|
||||||
|
|
||||||
JS::NonnullGCPtr<AudioDestinationNode> m_destination;
|
void queue_a_media_element_task(Function<void()> steps);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
|
JS::NonnullGCPtr<AudioDestinationNode> m_destination;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_sample_rate { 0 };
|
float m_sample_rate { 0 };
|
||||||
double m_current_time { 0 };
|
double m_current_time { 0 };
|
||||||
|
|
||||||
Bindings::AudioContextState m_control_thread_state = Bindings::AudioContextState::Suspended;
|
Bindings::AudioContextState m_control_thread_state = Bindings::AudioContextState::Suspended;
|
||||||
Bindings::AudioContextState m_rendering_thread_state = Bindings::AudioContextState::Suspended;
|
Bindings::AudioContextState m_rendering_thread_state = Bindings::AudioContextState::Suspended;
|
||||||
|
|
||||||
|
HTML::UniqueTaskSource m_media_element_event_task_source {};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user