OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 18 matching lines...) Expand all Loading... |
29 #define TALK_MEDIA_WEBRTCVOE_H_ | 29 #define TALK_MEDIA_WEBRTCVOE_H_ |
30 | 30 |
31 #include "talk/media/webrtc/webrtccommon.h" | 31 #include "talk/media/webrtc/webrtccommon.h" |
32 #include "webrtc/base/common.h" | 32 #include "webrtc/base/common.h" |
33 | 33 |
34 #include "webrtc/common_types.h" | 34 #include "webrtc/common_types.h" |
35 #include "webrtc/modules/audio_device/include/audio_device.h" | 35 #include "webrtc/modules/audio_device/include/audio_device.h" |
36 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 36 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
37 #include "webrtc/voice_engine/include/voe_base.h" | 37 #include "webrtc/voice_engine/include/voe_base.h" |
38 #include "webrtc/voice_engine/include/voe_codec.h" | 38 #include "webrtc/voice_engine/include/voe_codec.h" |
39 #include "webrtc/voice_engine/include/voe_dtmf.h" | |
40 #include "webrtc/voice_engine/include/voe_errors.h" | 39 #include "webrtc/voice_engine/include/voe_errors.h" |
41 #include "webrtc/voice_engine/include/voe_hardware.h" | 40 #include "webrtc/voice_engine/include/voe_hardware.h" |
42 #include "webrtc/voice_engine/include/voe_network.h" | 41 #include "webrtc/voice_engine/include/voe_network.h" |
43 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 42 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
44 #include "webrtc/voice_engine/include/voe_volume_control.h" | 43 #include "webrtc/voice_engine/include/voe_volume_control.h" |
45 | 44 |
46 namespace cricket { | 45 namespace cricket { |
47 // automatically handles lifetime of WebRtc VoiceEngine | 46 // automatically handles lifetime of WebRtc VoiceEngine |
48 class scoped_voe_engine { | 47 class scoped_voe_engine { |
49 public: | 48 public: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 private: | 83 private: |
85 T* ptr; | 84 T* ptr; |
86 }; | 85 }; |
87 | 86 |
88 // Utility class for aggregating the various WebRTC interface. | 87 // Utility class for aggregating the various WebRTC interface. |
89 // Fake implementations can also be injected for testing. | 88 // Fake implementations can also be injected for testing. |
90 class VoEWrapper { | 89 class VoEWrapper { |
91 public: | 90 public: |
92 VoEWrapper() | 91 VoEWrapper() |
93 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), | 92 : engine_(webrtc::VoiceEngine::Create()), processing_(engine_), |
94 base_(engine_), codec_(engine_), dtmf_(engine_), | 93 base_(engine_), codec_(engine_), |
95 hw_(engine_), network_(engine_), | 94 hw_(engine_), network_(engine_), |
96 rtp_(engine_), volume_(engine_) { | 95 rtp_(engine_), volume_(engine_) { |
97 } | 96 } |
98 VoEWrapper(webrtc::VoEAudioProcessing* processing, | 97 VoEWrapper(webrtc::VoEAudioProcessing* processing, |
99 webrtc::VoEBase* base, | 98 webrtc::VoEBase* base, |
100 webrtc::VoECodec* codec, | 99 webrtc::VoECodec* codec, |
101 webrtc::VoEDtmf* dtmf, | |
102 webrtc::VoEHardware* hw, | 100 webrtc::VoEHardware* hw, |
103 webrtc::VoENetwork* network, | 101 webrtc::VoENetwork* network, |
104 webrtc::VoERTP_RTCP* rtp, | 102 webrtc::VoERTP_RTCP* rtp, |
105 webrtc::VoEVolumeControl* volume) | 103 webrtc::VoEVolumeControl* volume) |
106 : engine_(NULL), | 104 : engine_(NULL), |
107 processing_(processing), | 105 processing_(processing), |
108 base_(base), | 106 base_(base), |
109 codec_(codec), | 107 codec_(codec), |
110 dtmf_(dtmf), | |
111 hw_(hw), | 108 hw_(hw), |
112 network_(network), | 109 network_(network), |
113 rtp_(rtp), | 110 rtp_(rtp), |
114 volume_(volume) { | 111 volume_(volume) { |
115 } | 112 } |
116 ~VoEWrapper() {} | 113 ~VoEWrapper() {} |
117 webrtc::VoiceEngine* engine() const { return engine_.get(); } | 114 webrtc::VoiceEngine* engine() const { return engine_.get(); } |
118 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } | 115 webrtc::VoEAudioProcessing* processing() const { return processing_.get(); } |
119 webrtc::VoEBase* base() const { return base_.get(); } | 116 webrtc::VoEBase* base() const { return base_.get(); } |
120 webrtc::VoECodec* codec() const { return codec_.get(); } | 117 webrtc::VoECodec* codec() const { return codec_.get(); } |
121 webrtc::VoEDtmf* dtmf() const { return dtmf_.get(); } | |
122 webrtc::VoEHardware* hw() const { return hw_.get(); } | 118 webrtc::VoEHardware* hw() const { return hw_.get(); } |
123 webrtc::VoENetwork* network() const { return network_.get(); } | 119 webrtc::VoENetwork* network() const { return network_.get(); } |
124 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } | 120 webrtc::VoERTP_RTCP* rtp() const { return rtp_.get(); } |
125 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } | 121 webrtc::VoEVolumeControl* volume() const { return volume_.get(); } |
126 int error() { return base_->LastError(); } | 122 int error() { return base_->LastError(); } |
127 | 123 |
128 private: | 124 private: |
129 scoped_voe_engine engine_; | 125 scoped_voe_engine engine_; |
130 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; | 126 scoped_voe_ptr<webrtc::VoEAudioProcessing> processing_; |
131 scoped_voe_ptr<webrtc::VoEBase> base_; | 127 scoped_voe_ptr<webrtc::VoEBase> base_; |
132 scoped_voe_ptr<webrtc::VoECodec> codec_; | 128 scoped_voe_ptr<webrtc::VoECodec> codec_; |
133 scoped_voe_ptr<webrtc::VoEDtmf> dtmf_; | |
134 scoped_voe_ptr<webrtc::VoEHardware> hw_; | 129 scoped_voe_ptr<webrtc::VoEHardware> hw_; |
135 scoped_voe_ptr<webrtc::VoENetwork> network_; | 130 scoped_voe_ptr<webrtc::VoENetwork> network_; |
136 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; | 131 scoped_voe_ptr<webrtc::VoERTP_RTCP> rtp_; |
137 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; | 132 scoped_voe_ptr<webrtc::VoEVolumeControl> volume_; |
138 }; | 133 }; |
139 } // namespace cricket | 134 } // namespace cricket |
140 | 135 |
141 #endif // TALK_MEDIA_WEBRTCVOE_H_ | 136 #endif // TALK_MEDIA_WEBRTCVOE_H_ |
OLD | NEW |