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

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

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

Powered by Google App Engine
This is Rietveld 408576698