| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // Use the Android configuration interface to set platform-specific | 301 // Use the Android configuration interface to set platform-specific |
| 302 // parameters. Should be done before player is realized. | 302 // parameters. Should be done before player is realized. |
| 303 SLAndroidConfigurationItf player_config; | 303 SLAndroidConfigurationItf player_config; |
| 304 RETURN_ON_ERROR( | 304 RETURN_ON_ERROR( |
| 305 player_object_->GetInterface(player_object_.Get(), | 305 player_object_->GetInterface(player_object_.Get(), |
| 306 SL_IID_ANDROIDCONFIGURATION, &player_config), | 306 SL_IID_ANDROIDCONFIGURATION, &player_config), |
| 307 false); | 307 false); |
| 308 // Set audio player configuration to SL_ANDROID_STREAM_VOICE which | 308 // Set audio player configuration to SL_ANDROID_STREAM_VOICE which |
| 309 // corresponds to android.media.AudioManager.STREAM_VOICE_CALL. | 309 // corresponds to android.media.AudioManager.STREAM_VOICE_CALL. |
| 310 SLint32 stream_type = SL_ANDROID_STREAM_VOICE; | 310 SLint32 stream_type = SL_ANDROID_STREAM_VOICE; |
| 311 if (!audio_manager_->IsCommunicationModeEnabled()) { | |
| 312 // But use STREAM_MUSIC if the user for some reason wants to run in a mode | |
| 313 // other than the preferred communication mode. | |
| 314 // SL_ANDROID_STREAM_MEDIA <=> android.media.AudioManager.STREAM_MUSIC. | |
| 315 stream_type = SL_ANDROID_STREAM_MEDIA; | |
| 316 ALOGW("Using non-default stream type SL_ANDROID_STREAM_MEDIA"); | |
| 317 } | |
| 318 RETURN_ON_ERROR( | 311 RETURN_ON_ERROR( |
| 319 (*player_config) | 312 (*player_config) |
| 320 ->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE, | 313 ->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE, |
| 321 &stream_type, sizeof(SLint32)), | 314 &stream_type, sizeof(SLint32)), |
| 322 false); | 315 false); |
| 323 | 316 |
| 324 // Realize the audio player object after configuration has been set. | 317 // Realize the audio player object after configuration has been set. |
| 325 RETURN_ON_ERROR( | 318 RETURN_ON_ERROR( |
| 326 player_object_->Realize(player_object_.Get(), SL_BOOLEAN_FALSE), false); | 319 player_object_->Realize(player_object_.Get(), SL_BOOLEAN_FALSE), false); |
| 327 | 320 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 RTC_DCHECK(player_); | 417 RTC_DCHECK(player_); |
| 425 SLuint32 state; | 418 SLuint32 state; |
| 426 SLresult err = (*player_)->GetPlayState(player_, &state); | 419 SLresult err = (*player_)->GetPlayState(player_, &state); |
| 427 if (SL_RESULT_SUCCESS != err) { | 420 if (SL_RESULT_SUCCESS != err) { |
| 428 ALOGE("GetPlayState failed: %d", err); | 421 ALOGE("GetPlayState failed: %d", err); |
| 429 } | 422 } |
| 430 return state; | 423 return state; |
| 431 } | 424 } |
| 432 | 425 |
| 433 } // namespace webrtc | 426 } // namespace webrtc |
| OLD | NEW |