OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 virtual ~AudioDeviceTemplate() { LOG(INFO) << __FUNCTION__; } | 47 virtual ~AudioDeviceTemplate() { LOG(INFO) << __FUNCTION__; } |
48 | 48 |
49 int32_t ActiveAudioLayer( | 49 int32_t ActiveAudioLayer( |
50 AudioDeviceModule::AudioLayer& audioLayer) const override { | 50 AudioDeviceModule::AudioLayer& audioLayer) const override { |
51 LOG(INFO) << __FUNCTION__; | 51 LOG(INFO) << __FUNCTION__; |
52 audioLayer = audio_layer_; | 52 audioLayer = audio_layer_; |
53 return 0; | 53 return 0; |
54 } | 54 } |
55 | 55 |
56 int32_t Init() override { | 56 InitStatus Init() override { |
57 LOG(INFO) << __FUNCTION__; | 57 LOG(INFO) << __FUNCTION__; |
58 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 58 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
59 RTC_DCHECK(!initialized_); | 59 RTC_DCHECK(!initialized_); |
60 if (!audio_manager_->Init()) | 60 if (!audio_manager_->Init()) { |
61 return -1; | 61 return InitStatus::OTHER_ERROR; |
| 62 } |
62 if (output_.Init() != 0) { | 63 if (output_.Init() != 0) { |
63 audio_manager_->Close(); | 64 audio_manager_->Close(); |
64 return -1; | 65 return InitStatus::PLAYOUT_ERROR; |
65 } | 66 } |
66 if (input_.Init() != 0) { | 67 if (input_.Init() != 0) { |
67 output_.Terminate(); | 68 output_.Terminate(); |
68 audio_manager_->Close(); | 69 audio_manager_->Close(); |
69 return -1; | 70 return InitStatus::RECORDING_ERROR; |
70 } | 71 } |
71 initialized_ = true; | 72 initialized_ = true; |
72 return 0; | 73 return InitStatus::OK; |
73 } | 74 } |
74 | 75 |
75 int32_t Terminate() override { | 76 int32_t Terminate() override { |
76 LOG(INFO) << __FUNCTION__; | 77 LOG(INFO) << __FUNCTION__; |
77 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 78 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
78 int32_t err = input_.Terminate(); | 79 int32_t err = input_.Terminate(); |
79 err |= output_.Terminate(); | 80 err |= output_.Terminate(); |
80 err |= !audio_manager_->Close(); | 81 err |= !audio_manager_->Close(); |
81 initialized_ = false; | 82 initialized_ = false; |
82 RTC_DCHECK_EQ(err, 0); | 83 RTC_DCHECK_EQ(err, 0); |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 OutputType output_; | 556 OutputType output_; |
556 | 557 |
557 InputType input_; | 558 InputType input_; |
558 | 559 |
559 bool initialized_; | 560 bool initialized_; |
560 }; | 561 }; |
561 | 562 |
562 } // namespace webrtc | 563 } // namespace webrtc |
563 | 564 |
564 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ | 565 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ |
OLD | NEW |