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

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

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Moved duplicated configuration from constructor to ConfigureStream (previously Reconfigure) Created 3 years, 8 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
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
(...skipping 10 matching lines...) Expand all
21 #include "webrtc/base/networkroute.h" 21 #include "webrtc/base/networkroute.h"
22 #include "webrtc/base/scoped_ref_ptr.h" 22 #include "webrtc/base/scoped_ref_ptr.h"
23 #include "webrtc/base/thread_checker.h" 23 #include "webrtc/base/thread_checker.h"
24 #include "webrtc/call/audio_state.h" 24 #include "webrtc/call/audio_state.h"
25 #include "webrtc/call/call.h" 25 #include "webrtc/call/call.h"
26 #include "webrtc/config.h" 26 #include "webrtc/config.h"
27 #include "webrtc/media/base/rtputils.h" 27 #include "webrtc/media/base/rtputils.h"
28 #include "webrtc/media/engine/apm_helpers.h" 28 #include "webrtc/media/engine/apm_helpers.h"
29 #include "webrtc/media/engine/webrtccommon.h" 29 #include "webrtc/media/engine/webrtccommon.h"
30 #include "webrtc/media/engine/webrtcvoe.h" 30 #include "webrtc/media/engine/webrtcvoe.h"
31 #include "webrtc/modules/audio_coding/codecs/audio_encoder_factory.h"
31 #include "webrtc/modules/audio_processing/include/audio_processing.h" 32 #include "webrtc/modules/audio_processing/include/audio_processing.h"
32 #include "webrtc/pc/channel.h" 33 #include "webrtc/pc/channel.h"
33 34
34 namespace webrtc { 35 namespace webrtc {
35 namespace voe { 36 namespace voe {
36 class TransmitMixer; 37 class TransmitMixer;
37 } // namespace voe 38 } // namespace voe
38 } // namespace webrtc 39 } // namespace webrtc
39 40
40 namespace cricket { 41 namespace cricket {
41 42
42 class AudioDeviceModule; 43 class AudioDeviceModule;
43 class AudioMixer; 44 class AudioMixer;
44 class AudioSource; 45 class AudioSource;
45 class VoEWrapper; 46 class VoEWrapper;
46 class WebRtcVoiceMediaChannel; 47 class WebRtcVoiceMediaChannel;
47 48
48 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. 49 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
49 // It uses the WebRtc VoiceEngine library for audio handling. 50 // It uses the WebRtc VoiceEngine library for audio handling.
50 class WebRtcVoiceEngine final : public webrtc::TraceCallback { 51 class WebRtcVoiceEngine final : public webrtc::TraceCallback {
51 friend class WebRtcVoiceMediaChannel; 52 friend class WebRtcVoiceMediaChannel;
52 public: 53 public:
53 // Exposed for the WVoE/MC unit test.
54 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out);
55
56 WebRtcVoiceEngine( 54 WebRtcVoiceEngine(
57 webrtc::AudioDeviceModule* adm, 55 webrtc::AudioDeviceModule* adm,
58 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, 56 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
59 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer); 57 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer);
60 // Dependency injection for testing. 58 // Dependency injection for testing.
61 WebRtcVoiceEngine( 59 WebRtcVoiceEngine(
62 webrtc::AudioDeviceModule* adm, 60 webrtc::AudioDeviceModule* adm,
63 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, 61 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
64 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, 62 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
65 VoEWrapper* voe_wrapper); 63 VoEWrapper* voe_wrapper);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 104
107 // webrtc::TraceCallback: 105 // webrtc::TraceCallback:
108 void Print(webrtc::TraceLevel level, const char* trace, int length) override; 106 void Print(webrtc::TraceLevel level, const char* trace, int length) override;
109 107
110 void StartAecDump(const std::string& filename); 108 void StartAecDump(const std::string& filename);
111 int CreateVoEChannel(); 109 int CreateVoEChannel();
112 webrtc::AudioDeviceModule* adm(); 110 webrtc::AudioDeviceModule* adm();
113 webrtc::AudioProcessing* apm(); 111 webrtc::AudioProcessing* apm();
114 webrtc::voe::TransmitMixer* transmit_mixer(); 112 webrtc::voe::TransmitMixer* transmit_mixer();
115 113
116 AudioCodecs CollectRecvCodecs() const; 114 AudioCodecs CollectCodecs(
115 const std::vector<webrtc::AudioCodecSpec>& specs) const;
117 116
118 rtc::ThreadChecker signal_thread_checker_; 117 rtc::ThreadChecker signal_thread_checker_;
119 rtc::ThreadChecker worker_thread_checker_; 118 rtc::ThreadChecker worker_thread_checker_;
120 119
121 // The audio device manager. 120 // The audio device manager.
122 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_; 121 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm_;
122 rtc::scoped_refptr<webrtc::AudioEncoderFactory> encoder_factory_;
123 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_; 123 rtc::scoped_refptr<webrtc::AudioDecoderFactory> decoder_factory_;
124 // Reference to the APM, owned by VoE. 124 // Reference to the APM, owned by VoE.
125 webrtc::AudioProcessing* apm_ = nullptr; 125 webrtc::AudioProcessing* apm_ = nullptr;
126 // Reference to the TransmitMixer, owned by VoE. 126 // Reference to the TransmitMixer, owned by VoE.
127 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; 127 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr;
128 // The primary instance of WebRtc VoiceEngine. 128 // The primary instance of WebRtc VoiceEngine.
129 std::unique_ptr<VoEWrapper> voe_wrapper_; 129 std::unique_ptr<VoEWrapper> voe_wrapper_;
130 rtc::scoped_refptr<webrtc::AudioState> audio_state_; 130 rtc::scoped_refptr<webrtc::AudioState> audio_state_;
131 std::vector<AudioCodec> send_codecs_; 131 std::vector<AudioCodec> send_codecs_;
132 std::vector<AudioCodec> recv_codecs_; 132 std::vector<AudioCodec> recv_codecs_;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; 281 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u;
282 282
283 class WebRtcAudioSendStream; 283 class WebRtcAudioSendStream;
284 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; 284 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
285 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 285 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
286 286
287 class WebRtcAudioReceiveStream; 287 class WebRtcAudioReceiveStream;
288 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; 288 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
289 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 289 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
290 290
291 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec_; 291 rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec>
292 send_codec_spec_;
292 293
293 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 294 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
294 }; 295 };
295 } // namespace cricket 296 } // namespace cricket
296 297
297 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 298 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698