| 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 } |
| 311 RETURN_ON_ERROR( | 318 RETURN_ON_ERROR( |
| 312 (*player_config) | 319 (*player_config) |
| 313 ->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE, | 320 ->SetConfiguration(player_config, SL_ANDROID_KEY_STREAM_TYPE, |
| 314 &stream_type, sizeof(SLint32)), | 321 &stream_type, sizeof(SLint32)), |
| 315 false); | 322 false); |
| 316 | 323 |
| 317 // Realize the audio player object after configuration has been set. | 324 // Realize the audio player object after configuration has been set. |
| 318 RETURN_ON_ERROR( | 325 RETURN_ON_ERROR( |
| 319 player_object_->Realize(player_object_.Get(), SL_BOOLEAN_FALSE), false); | 326 player_object_->Realize(player_object_.Get(), SL_BOOLEAN_FALSE), false); |
| 320 | 327 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 RTC_DCHECK(player_); | 424 RTC_DCHECK(player_); |
| 418 SLuint32 state; | 425 SLuint32 state; |
| 419 SLresult err = (*player_)->GetPlayState(player_, &state); | 426 SLresult err = (*player_)->GetPlayState(player_, &state); |
| 420 if (SL_RESULT_SUCCESS != err) { | 427 if (SL_RESULT_SUCCESS != err) { |
| 421 ALOGE("GetPlayState failed: %d", err); | 428 ALOGE("GetPlayState failed: %d", err); |
| 422 } | 429 } |
| 423 return state; | 430 return state; |
| 424 } | 431 } |
| 425 | 432 |
| 426 } // namespace webrtc | 433 } // namespace webrtc |
| OLD | NEW |