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

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

Issue 1296693003: Fix initialization/termination of AudioDeviceTemplate (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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 | no next file » | 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 int32_t ActiveAudioLayer( 54 int32_t ActiveAudioLayer(
55 AudioDeviceModule::AudioLayer& audioLayer) const override { 55 AudioDeviceModule::AudioLayer& audioLayer) const override {
56 audioLayer = audio_layer_; 56 audioLayer = audio_layer_;
57 return 0; 57 return 0;
58 } 58 }
59 59
60 int32_t Init() override { 60 int32_t Init() override {
61 DCHECK(thread_checker_.CalledOnValidThread()); 61 DCHECK(thread_checker_.CalledOnValidThread());
62 DCHECK(!initialized_); 62 DCHECK(!initialized_);
63 initialized_ = audio_manager_->Init() || output_.Init() || input_.Init(); 63 initialized_ =
64 audio_manager_->Init() & ((output_.Init() | input_.Init()) == 0);
tommi (sloooow) - chröme 2015/08/17 08:23:19 Great that you noticed this. Why bitwise operator
Satoshi Matsumoto 2015/08/17 16:40:23 Done.
64 return initialized_ ? 0 : -1; 65 return initialized_ ? 0 : -1;
65 } 66 }
66 67
67 int32_t Terminate() override { 68 int32_t Terminate() override {
68 DCHECK(thread_checker_.CalledOnValidThread()); 69 DCHECK(thread_checker_.CalledOnValidThread());
69 initialized_ = 70 initialized_ = ((output_.Terminate() | input_.Terminate()) != 0) |
70 !(output_.Terminate() || input_.Terminate() || audio_manager_->Close()); 71 !audio_manager_->Close();
tommi (sloooow) - chröme 2015/08/17 08:23:19 There's not really much we can do here if things g
Satoshi Matsumoto 2015/08/17 16:40:23 Done.
71 return !initialized_ ? 0 : -1; 72 return !initialized_ ? 0 : -1;
72 } 73 }
73 74
74 bool Initialized() const override { 75 bool Initialized() const override {
75 DCHECK(thread_checker_.CalledOnValidThread()); 76 DCHECK(thread_checker_.CalledOnValidThread());
76 return initialized_; 77 return initialized_;
77 } 78 }
78 79
79 int16_t PlayoutDevices() override { 80 int16_t PlayoutDevices() override {
80 return 1; 81 return 1;
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 OutputType output_; 463 OutputType output_;
463 464
464 InputType input_; 465 InputType input_;
465 466
466 bool initialized_; 467 bool initialized_;
467 }; 468 };
468 469
469 } // namespace webrtc 470 } // namespace webrtc
470 471
471 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_ 472 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_DEVICE_TEMPLATE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698