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

Unified Diff: media/audio/audio_manager_base.cc

Issue 1490533002: Merge M48: "Ensure both default audio device IDs are handled for creation." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager_base.cc
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index 8c1dda29f70d474529735256c9c7a6416ba04511..73ed1cf2216abb19e514e2930a751db57020f9d3 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -76,6 +76,10 @@ class AudioManagerBase::CompareByParams {
const DispatcherParams* dispatcher_;
};
+static bool IsDefaultDeviceId(const std::string& device_id) {
+ return device_id.empty() || device_id == AudioManagerBase::kDefaultDeviceId;
+}
+
AudioManagerBase::AudioManagerBase(AudioLogFactory* audio_log_factory)
: max_num_output_streams_(kDefaultMaxOutputStreams),
max_num_input_streams_(kDefaultMaxInputStreams),
@@ -162,7 +166,7 @@ AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
AudioOutputStream* stream;
switch (params.format()) {
case AudioParameters::AUDIO_PCM_LINEAR:
- DCHECK(device_id.empty())
+ DCHECK(IsDefaultDeviceId(device_id))
<< "AUDIO_PCM_LINEAR supports only the default device.";
stream = MakeLinearOutputStream(params);
break;
@@ -241,8 +245,8 @@ AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
// "default" or via the specific id.
// NOTE: Implementations that don't yet support opening non-default output
// devices may return an empty string from GetDefaultOutputDeviceID().
- std::string output_device_id = device_id.empty() ?
- GetDefaultOutputDeviceID() : device_id;
+ std::string output_device_id =
+ IsDefaultDeviceId(device_id) ? GetDefaultOutputDeviceID() : device_id;
// If we're not using AudioOutputResampler our output parameters are the same
// as our input parameters.
« no previous file with comments | « no previous file | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698