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

Side by Side Diff: webrtc/media/engine/webrtcvoe.h

Issue 2737633002: Remove VoEHardware interface usage. (Closed)
Patch Set: comments + compile issue Created 3 years, 9 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 | « webrtc/media/engine/fakewebrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine.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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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
11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ 11 #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_
12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ 12 #define WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/media/engine/webrtccommon.h" 16 #include "webrtc/media/engine/webrtccommon.h"
17 17
18 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
19 #include "webrtc/modules/audio_device/include/audio_device.h" 19 #include "webrtc/modules/audio_device/include/audio_device.h"
20 #include "webrtc/voice_engine/include/voe_base.h" 20 #include "webrtc/voice_engine/include/voe_base.h"
21 #include "webrtc/voice_engine/include/voe_codec.h" 21 #include "webrtc/voice_engine/include/voe_codec.h"
22 #include "webrtc/voice_engine/include/voe_errors.h" 22 #include "webrtc/voice_engine/include/voe_errors.h"
23 #include "webrtc/voice_engine/include/voe_hardware.h"
24 23
25 namespace cricket { 24 namespace cricket {
26 // automatically handles lifetime of WebRtc VoiceEngine 25 // automatically handles lifetime of WebRtc VoiceEngine
27 class scoped_voe_engine { 26 class scoped_voe_engine {
28 public: 27 public:
29 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {} 28 explicit scoped_voe_engine(webrtc::VoiceEngine* e) : ptr(e) {}
30 // RTC_DCHECK, to ensure that there are no leaks at shutdown 29 // RTC_DCHECK, to ensure that there are no leaks at shutdown
31 ~scoped_voe_engine() { 30 ~scoped_voe_engine() {
32 if (ptr) { 31 if (ptr) {
33 const bool success = webrtc::VoiceEngine::Delete(ptr); 32 const bool success = webrtc::VoiceEngine::Delete(ptr);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 private: 69 private:
71 T* ptr; 70 T* ptr;
72 }; 71 };
73 72
74 // Utility class for aggregating the various WebRTC interface. 73 // Utility class for aggregating the various WebRTC interface.
75 // Fake implementations can also be injected for testing. 74 // Fake implementations can also be injected for testing.
76 class VoEWrapper { 75 class VoEWrapper {
77 public: 76 public:
78 VoEWrapper() 77 VoEWrapper()
79 : engine_(webrtc::VoiceEngine::Create()), 78 : engine_(webrtc::VoiceEngine::Create()),
80 base_(engine_), codec_(engine_), hw_(engine_) { 79 base_(engine_), codec_(engine_) {
81 } 80 }
82 VoEWrapper(webrtc::VoEBase* base, 81 VoEWrapper(webrtc::VoEBase* base,
83 webrtc::VoECodec* codec, 82 webrtc::VoECodec* codec)
84 webrtc::VoEHardware* hw)
85 : engine_(NULL), 83 : engine_(NULL),
86 base_(base), 84 base_(base),
87 codec_(codec), 85 codec_(codec) {
88 hw_(hw) {
89 } 86 }
90 ~VoEWrapper() {} 87 ~VoEWrapper() {}
91 webrtc::VoiceEngine* engine() const { return engine_.get(); } 88 webrtc::VoiceEngine* engine() const { return engine_.get(); }
92 webrtc::VoEBase* base() const { return base_.get(); } 89 webrtc::VoEBase* base() const { return base_.get(); }
93 webrtc::VoECodec* codec() const { return codec_.get(); } 90 webrtc::VoECodec* codec() const { return codec_.get(); }
94 webrtc::VoEHardware* hw() const { return hw_.get(); }
95 int error() { return base_->LastError(); } 91 int error() { return base_->LastError(); }
96 92
97 private: 93 private:
98 scoped_voe_engine engine_; 94 scoped_voe_engine engine_;
99 scoped_voe_ptr<webrtc::VoEBase> base_; 95 scoped_voe_ptr<webrtc::VoEBase> base_;
100 scoped_voe_ptr<webrtc::VoECodec> codec_; 96 scoped_voe_ptr<webrtc::VoECodec> codec_;
101 scoped_voe_ptr<webrtc::VoEHardware> hw_;
102 }; 97 };
103 } // namespace cricket 98 } // namespace cricket
104 99
105 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_ 100 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOE_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698