OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/audio/android/audio_manager_android.h" | 5 #include "media/audio/android/audio_manager_android.h" |
6 | 6 |
7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/android/context_utils.h" | 8 #include "base/android/context_utils.h" |
9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // device, i.e., this selection does also switch the output device. | 256 // device, i.e., this selection does also switch the output device. |
257 // All input and output streams will be affected by the device selection. | 257 // All input and output streams will be affected by the device selection. |
258 if (!SetAudioDevice(device_id)) { | 258 if (!SetAudioDevice(device_id)) { |
259 LOG(ERROR) << "Unable to select audio device!"; | 259 LOG(ERROR) << "Unable to select audio device!"; |
260 return NULL; | 260 return NULL; |
261 } | 261 } |
262 | 262 |
263 if (params.effects() != AudioParameters::NO_EFFECTS) { | 263 if (params.effects() != AudioParameters::NO_EFFECTS) { |
264 // Platform effects can only be enabled through the AudioRecord path. | 264 // Platform effects can only be enabled through the AudioRecord path. |
265 // An effect should only have been requested here if recommended by | 265 // An effect should only have been requested here if recommended by |
266 // AudioManagerAndroid.shouldUse<Effect>. | 266 // AudioManagerAndroid#shouldUse...(). |
267 // | |
268 // Creating this class requires Jelly Bean, which is already guaranteed by | |
269 // shouldUse<Effect>. Only DCHECK on that condition to allow tests to use | |
270 // the effect settings as a way to select the input path. | |
271 DCHECK_GE(base::android::BuildInfo::GetInstance()->sdk_int(), 16); | |
272 DVLOG(1) << "Creating AudioRecordInputStream"; | 267 DVLOG(1) << "Creating AudioRecordInputStream"; |
273 return new AudioRecordInputStream(this, params); | 268 return new AudioRecordInputStream(this, params); |
274 } | 269 } |
275 DVLOG(1) << "Creating OpenSLESInputStream"; | 270 DVLOG(1) << "Creating OpenSLESInputStream"; |
276 return new OpenSLESInputStream(this, params); | 271 return new OpenSLESInputStream(this, params); |
277 } | 272 } |
278 | 273 |
279 // static | 274 // static |
280 bool AudioManagerAndroid::RegisterAudioManager(JNIEnv* env) { | 275 bool AudioManagerAndroid::RegisterAudioManager(JNIEnv* env) { |
281 return RegisterNativesImpl(env); | 276 return RegisterNativesImpl(env); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 output_volume_override_ = volume; | 419 output_volume_override_ = volume; |
425 | 420 |
426 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); | 421 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); |
427 for (OutputStreams::iterator it = streams_.begin(); | 422 for (OutputStreams::iterator it = streams_.begin(); |
428 it != streams_.end(); ++it) { | 423 it != streams_.end(); ++it) { |
429 (*it)->SetVolume(volume); | 424 (*it)->SetVolume(volume); |
430 } | 425 } |
431 } | 426 } |
432 | 427 |
433 } // namespace media | 428 } // namespace media |
OLD | NEW |