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

Side by Side Diff: webrtc/modules/audio_device/android/audio_device_template.h

Issue 3009193002: Improves stereo/mono audio support on Android (Closed)
Patch Set: nit Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_device/android/audio_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 int32_t SetMicrophoneMute(bool enable) override { 324 int32_t SetMicrophoneMute(bool enable) override {
325 FATAL() << "Not implemented"; 325 FATAL() << "Not implemented";
326 return -1; 326 return -1;
327 } 327 }
328 328
329 int32_t MicrophoneMute(bool& enabled) const override { 329 int32_t MicrophoneMute(bool& enabled) const override {
330 FATAL() << "Not implemented"; 330 FATAL() << "Not implemented";
331 return -1; 331 return -1;
332 } 332 }
333 333
334 // Returns true if the audio manager has been configured to support stereo
335 // and false otherwised. Default is mono.
334 int32_t StereoPlayoutIsAvailable(bool& available) override { 336 int32_t StereoPlayoutIsAvailable(bool& available) override {
335 LOG(INFO) << __FUNCTION__; 337 LOG(INFO) << __FUNCTION__;
336 available = false; 338 available = audio_manager_->IsStereoPlayoutSupported();
337 return 0; 339 return 0;
338 } 340 }
339 341
340 // TODO(henrika): add support.
341 int32_t SetStereoPlayout(bool enable) override { 342 int32_t SetStereoPlayout(bool enable) override {
342 LOG(INFO) << __FUNCTION__; 343 LOG(INFO) << __FUNCTION__;
343 // Allow disabling stereo playout, as that matches returning false(0) from 344 bool available = audio_manager_->IsStereoPlayoutSupported();
344 // StereoPlayoutIsAvailable and is the default case. 345 // Android does not support changes between mono and stero on the fly.
345 return enable ? -1 : 0; 346 // Instead, the native audio layer is configured via the audio manager
347 // to either support mono or stereo. It is allowed to call this method
348 // if that same state is not modified.
349 return (enable == available) ? 0 : -1;
346 } 350 }
347 351
348 // TODO(henrika): add support.
349 int32_t StereoPlayout(bool& enabled) const override { 352 int32_t StereoPlayout(bool& enabled) const override {
350 enabled = false; 353 enabled = audio_manager_->IsStereoPlayoutSupported();
351 FATAL() << "Should never be called"; 354 return 0;
352 return -1;
353 } 355 }
354 356
355 int32_t StereoRecordingIsAvailable(bool& available) override { 357 int32_t StereoRecordingIsAvailable(bool& available) override {
356 LOG(INFO) << __FUNCTION__; 358 LOG(INFO) << __FUNCTION__;
357 available = false; 359 available = audio_manager_->IsStereoRecordSupported();
358 return 0; 360 return 0;
359 } 361 }
360 362
361 int32_t SetStereoRecording(bool enable) override { 363 int32_t SetStereoRecording(bool enable) override {
362 LOG(INFO) << __FUNCTION__; 364 LOG(INFO) << __FUNCTION__;
363 return -1; 365 bool available = audio_manager_->IsStereoRecordSupported();
366 // Android does not support changes between mono and stero on the fly.
367 // Instead, the native audio layer is configured via the audio manager
368 // to either support mono or stereo. It is allowed to call this method
369 // if that same state is not modified.
370 return (enable == available) ? 0 : -1;
364 } 371 }
365 372
366 int32_t StereoRecording(bool& enabled) const override { 373 int32_t StereoRecording(bool& enabled) const override {
367 LOG(INFO) << __FUNCTION__; 374 LOG(INFO) << __FUNCTION__;
368 enabled = false; 375 enabled = audio_manager_->IsStereoRecordSupported();
369 return 0; 376 return 0;
370 } 377 }
371 378
372 int32_t PlayoutDelay(uint16_t& delay_ms) const override { 379 int32_t PlayoutDelay(uint16_t& delay_ms) const override {
373 // Best guess we can do is to use half of the estimated total delay. 380 // Best guess we can do is to use half of the estimated total delay.
374 delay_ms = audio_manager_->GetDelayEstimateInMilliseconds() / 2; 381 delay_ms = audio_manager_->GetDelayEstimateInMilliseconds() / 2;
375 RTC_DCHECK_GT(delay_ms, 0); 382 RTC_DCHECK_GT(delay_ms, 0);
376 return 0; 383 return 0;
377 } 384 }
378 385
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 OutputType output_; 509 OutputType output_;
503 510
504 InputType input_; 511 InputType input_;
505 512
506 bool initialized_; 513 bool initialized_;
507 }; 514 };
508 515
509 } // namespace webrtc 516 } // namespace webrtc
510 517
511 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ 518 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_device/android/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698