| Index: components/audio_modem/audio_player_impl.cc
|
| diff --git a/components/audio_modem/audio_player_impl.cc b/components/audio_modem/audio_player_impl.cc
|
| index 2a02f5aa6ef9fd8ac1e1c3e86e62e2c7e13ca023..cd52f05485ab4bd87a6daae246eff38ffaef85b2 100644
|
| --- a/components/audio_modem/audio_player_impl.cc
|
| +++ b/components/audio_modem/audio_player_impl.cc
|
| @@ -8,9 +8,11 @@
|
| #include <string>
|
|
|
| #include "base/bind.h"
|
| -#include "base/location.h"
|
| +#include "base/bind_helpers.h"
|
| #include "base/logging.h"
|
| +#include "base/run_loop.h"
|
| #include "components/audio_modem/public/audio_modem_types.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "media/audio/audio_manager.h"
|
| #include "media/audio/audio_parameters.h"
|
| #include "media/base/audio_bus.h"
|
| @@ -160,4 +162,19 @@
|
| base::Unretained(this)));
|
| }
|
|
|
| +void AudioPlayerImpl::FlushAudioLoopForTesting() {
|
| + if (media::AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread())
|
| + return;
|
| +
|
| + // Queue task on the audio thread, when it is executed, that means we've
|
| + // successfully executed all the tasks before us.
|
| + base::RunLoop rl;
|
| + media::AudioManager::Get()->GetTaskRunner()->PostTaskAndReply(
|
| + FROM_HERE,
|
| + base::Bind(base::IgnoreResult(&AudioPlayerImpl::FlushAudioLoopForTesting),
|
| + base::Unretained(this)),
|
| + rl.QuitClosure());
|
| + rl.Run();
|
| +}
|
| +
|
| } // namespace audio_modem
|
|
|