Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: media/audio/audio_system_impl.cc

Issue 2761273003: Switching MediaStreamsManager from using AudioManager interface to AudioSystem one. (Closed)
Patch Set: passing device descriptions by value Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_system_impl.cc
diff --git a/media/audio/audio_system_impl.cc b/media/audio/audio_system_impl.cc
index a6c51a67d863a6086b33b9e470c97d1b8ebf4471..00ea330761b28861dc27bd55cdc39f9ffc1c8337 100644
--- a/media/audio/audio_system_impl.cc
+++ b/media/audio/audio_system_impl.cc
@@ -45,6 +45,18 @@ AudioParameters GetOutputParametersOnDeviceThread(
: audio_manager->GetOutputStreamParameters(device_id);
}
+AudioDeviceDescriptions GetDeviceDescriptionsOnDeviceThread(
+ AudioManager* audio_manager,
+ bool for_input) {
+ DCHECK(audio_manager->GetTaskRunner()->BelongsToCurrentThread());
+ AudioDeviceDescriptions descriptions;
+ if (for_input)
+ audio_manager->GetAudioInputDeviceDescriptions(&descriptions);
+ else
+ audio_manager->GetAudioOutputDeviceDescriptions(&descriptions);
+ return descriptions;
+}
+
} // namespace
AudioSystemImpl::AudioSystemImpl(AudioManager* audio_manager)
@@ -109,6 +121,24 @@ void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const {
std::move(on_has_devices_cb));
}
+void AudioSystemImpl::GetDeviceDescriptions(
+ OnDeviceDescriptionsCallback on_descriptions_cp,
+ bool for_input) {
+ if (GetTaskRunner()->BelongsToCurrentThread()) {
+ GetTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(on_descriptions_cp,
+ base::Passed(GetDeviceDescriptionsOnDeviceThread(
+ audio_manager_, for_input))));
+ return;
+ }
+
+ base::PostTaskAndReplyWithResult(
+ GetTaskRunner(), FROM_HERE,
+ base::Bind(&GetDeviceDescriptionsOnDeviceThread,
+ base::Unretained(audio_manager_), for_input),
+ std::move(on_descriptions_cp));
+}
+
AudioManager* AudioSystemImpl::GetAudioManager() const {
return audio_manager_;
}

Powered by Google App Engine
This is Rietveld 408576698