mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:12:44 +00:00 
			
		
		
		
	Ladybird+LibWeb+WebConent: Drive audio in Ladybird off the main thread
The main thread in the WebContent process is often busy with layout and running JavaScript. This can cause audio to sound jittery and crack. To avoid this behavior, we now drive audio on a secondary thread. Note: Browser on Serenity uses AudioServer, the connection for which is already handled on a secondary thread within LibAudio. So this only applies to Lagom. Rather than using LibThreading, our hands are tied to QThread for now. Internally, the Qt media objects use a QTimer, which is forbidden from running on a thread that is not a QThread (the debug console is spammed with messages pointing this out). Ideally, in the future AudioServer will be able to run for non-Serenity platforms, and most of this can be aligned with the Serenity implementation.
This commit is contained in:
		
							parent
							
								
									0fd35b4dd8
								
							
						
					
					
						commit
						1c4dd0caad
					
				
					 10 changed files with 383 additions and 205 deletions
				
			
		|  | @ -13,6 +13,7 @@ | |||
| #include "../WebSocketClientManagerLadybird.h" | ||||
| #include <AK/LexicalPath.h> | ||||
| #include <AK/Platform.h> | ||||
| #include <LibAudio/Loader.h> | ||||
| #include <LibCore/ArgsParser.h> | ||||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/LocalServer.h> | ||||
|  | @ -59,8 +60,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | |||
|     Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity); | ||||
|     Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird); | ||||
| 
 | ||||
|     Web::Platform::AudioCodecPlugin::install_creation_hook([] { | ||||
|         return Ladybird::AudioCodecPluginLadybird::create(); | ||||
|     Web::Platform::AudioCodecPlugin::install_creation_hook([](auto loader) { | ||||
|         return Ladybird::AudioCodecPluginLadybird::create(move(loader)); | ||||
|     }); | ||||
| 
 | ||||
|     Web::ResourceLoader::initialize(RequestManagerQt::create()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn