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

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

Issue 2405183002: Moving WebRtcVoiceMediaChannel::SendSetCodec to AudioSendStream. (Closed)
Patch Set: final change Created 4 years, 2 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/audio/audio_send_stream_unittest.cc ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('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
(...skipping 19 matching lines...) Expand all
30 #include "webrtc/media/engine/webrtcvoe.h" 30 #include "webrtc/media/engine/webrtcvoe.h"
31 #include "webrtc/pc/channel.h" 31 #include "webrtc/pc/channel.h"
32 32
33 namespace cricket { 33 namespace cricket {
34 34
35 class AudioDeviceModule; 35 class AudioDeviceModule;
36 class AudioSource; 36 class AudioSource;
37 class VoEWrapper; 37 class VoEWrapper;
38 class WebRtcVoiceMediaChannel; 38 class WebRtcVoiceMediaChannel;
39 39
40 struct SendCodecSpec {
41 SendCodecSpec() {
42 webrtc::CodecInst empty_inst = {0};
43 codec_inst = empty_inst;
44 codec_inst.pltype = -1;
45 }
46 bool operator==(const SendCodecSpec& rhs) const;
47 bool operator!=(const SendCodecSpec& rhs) const;
48
49 bool nack_enabled = false;
50 bool transport_cc_enabled = false;
51 bool enable_codec_fec = false;
52 bool enable_opus_dtx = false;
53 int opus_max_playback_rate = 0;
54 int red_payload_type = -1;
55 int cng_payload_type = -1;
56 int cng_plfreq = -1;
57 webrtc::CodecInst codec_inst;
58 };
59
60 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. 40 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
61 // It uses the WebRtc VoiceEngine library for audio handling. 41 // It uses the WebRtc VoiceEngine library for audio handling.
62 class WebRtcVoiceEngine final : public webrtc::TraceCallback { 42 class WebRtcVoiceEngine final : public webrtc::TraceCallback {
63 friend class WebRtcVoiceMediaChannel; 43 friend class WebRtcVoiceMediaChannel;
64 public: 44 public:
65 // Exposed for the WVoE/MC unit test. 45 // Exposed for the WVoE/MC unit test.
66 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out); 46 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out);
67 47
68 WebRtcVoiceEngine( 48 WebRtcVoiceEngine(
69 webrtc::AudioDeviceModule* adm, 49 webrtc::AudioDeviceModule* adm,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions()); 210 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
231 } 211 }
232 212
233 int GetReceiveChannelId(uint32_t ssrc) const; 213 int GetReceiveChannelId(uint32_t ssrc) const;
234 int GetSendChannelId(uint32_t ssrc) const; 214 int GetSendChannelId(uint32_t ssrc) const;
235 215
236 private: 216 private:
237 bool SetOptions(const AudioOptions& options); 217 bool SetOptions(const AudioOptions& options);
238 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); 218 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
239 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); 219 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
240 bool SetSendCodecs(int channel, const webrtc::RtpParameters& rtp_parameters);
241 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
242 bool SetLocalSource(uint32_t ssrc, AudioSource* source); 220 bool SetLocalSource(uint32_t ssrc, AudioSource* source);
243 bool MuteStream(uint32_t ssrc, bool mute); 221 bool MuteStream(uint32_t ssrc, bool mute);
244 222
245 WebRtcVoiceEngine* engine() { return engine_; } 223 WebRtcVoiceEngine* engine() { return engine_; }
246 int GetLastEngineError() { return engine()->GetLastEngineError(); } 224 int GetLastEngineError() { return engine()->GetLastEngineError(); }
247 int GetOutputLevel(int channel); 225 int GetOutputLevel(int channel);
248 int CreateVoEChannel(); 226 int CreateVoEChannel();
249 bool DeleteVoEChannel(int channel); 227 bool DeleteVoEChannel(int channel);
250 bool IsDefaultRecvStream(uint32_t ssrc) { 228 bool IsDefaultRecvStream(uint32_t ssrc) {
251 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); 229 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
252 } 230 }
253 bool SetMaxSendBitrate(int bps); 231 bool SetMaxSendBitrate(int bps);
254 bool SetChannelSendParameters(int channel,
255 const webrtc::RtpParameters& parameters);
256 bool SetMaxSendBitrate(int channel, int bps);
257 bool HasSendCodec() const {
258 return send_codec_spec_.codec_inst.pltype != -1;
259 }
260 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters); 232 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
261 void SetupRecording(); 233 void SetupRecording();
262 234
263 rtc::ThreadChecker worker_thread_checker_; 235 rtc::ThreadChecker worker_thread_checker_;
264 236
265 WebRtcVoiceEngine* const engine_ = nullptr; 237 WebRtcVoiceEngine* const engine_ = nullptr;
266 std::vector<AudioCodec> send_codecs_; 238 std::vector<AudioCodec> send_codecs_;
267 std::vector<AudioCodec> recv_codecs_; 239 std::vector<AudioCodec> recv_codecs_;
268 int max_send_bitrate_bps_ = 0; 240 int max_send_bitrate_bps_ = 0;
269 AudioOptions options_; 241 AudioOptions options_;
(...skipping 16 matching lines...) Expand all
286 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; 258 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u;
287 259
288 class WebRtcAudioSendStream; 260 class WebRtcAudioSendStream;
289 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; 261 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
290 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 262 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
291 263
292 class WebRtcAudioReceiveStream; 264 class WebRtcAudioReceiveStream;
293 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; 265 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
294 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 266 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
295 267
296 SendCodecSpec send_codec_spec_; 268 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec_;
297 269
298 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 270 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
299 }; 271 };
300 } // namespace cricket 272 } // namespace cricket
301 273
302 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 274 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream_unittest.cc ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698