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

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

Issue 1741933002: Prevent a voice channel from sending data before a renderer is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Modifying copyright header to satisfy presubmit bot. Created 4 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.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 13 matching lines...) Expand all
24 #include "webrtc/common.h" 24 #include "webrtc/common.h"
25 #include "webrtc/config.h" 25 #include "webrtc/config.h"
26 #include "webrtc/media/base/rtputils.h" 26 #include "webrtc/media/base/rtputils.h"
27 #include "webrtc/media/engine/webrtccommon.h" 27 #include "webrtc/media/engine/webrtccommon.h"
28 #include "webrtc/media/engine/webrtcvoe.h" 28 #include "webrtc/media/engine/webrtcvoe.h"
29 #include "webrtc/pc/channel.h" 29 #include "webrtc/pc/channel.h"
30 30
31 namespace cricket { 31 namespace cricket {
32 32
33 class AudioDeviceModule; 33 class AudioDeviceModule;
34 class AudioRenderer; 34 class AudioSource;
35 class VoEWrapper; 35 class VoEWrapper;
36 class WebRtcVoiceMediaChannel; 36 class WebRtcVoiceMediaChannel;
37 37
38 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine. 38 // WebRtcVoiceEngine is a class to be used with CompositeMediaEngine.
39 // It uses the WebRtc VoiceEngine library for audio handling. 39 // It uses the WebRtc VoiceEngine library for audio handling.
40 class WebRtcVoiceEngine final : public webrtc::TraceCallback { 40 class WebRtcVoiceEngine final : public webrtc::TraceCallback {
41 friend class WebRtcVoiceMediaChannel; 41 friend class WebRtcVoiceMediaChannel;
42 public: 42 public:
43 // Exposed for the WVoE/MC unit test. 43 // Exposed for the WVoE/MC unit test.
44 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out); 44 static bool ToCodecInst(const AudioCodec& in, webrtc::CodecInst* out);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 const AudioOptions& options() const { return options_; } 149 const AudioOptions& options() const { return options_; }
150 150
151 rtc::DiffServCodePoint PreferredDscp() const override; 151 rtc::DiffServCodePoint PreferredDscp() const override;
152 152
153 bool SetSendParameters(const AudioSendParameters& params) override; 153 bool SetSendParameters(const AudioSendParameters& params) override;
154 bool SetRecvParameters(const AudioRecvParameters& params) override; 154 bool SetRecvParameters(const AudioRecvParameters& params) override;
155 bool SetPlayout(bool playout) override; 155 bool SetPlayout(bool playout) override;
156 bool PausePlayout(); 156 bool PausePlayout();
157 bool ResumePlayout(); 157 bool ResumePlayout();
158 bool SetSend(SendFlags send) override; 158 void SetSend(bool send) override;
159 bool PauseSend(); 159 bool PauseSend();
160 bool ResumeSend(); 160 bool ResumeSend();
161 bool SetAudioSend(uint32_t ssrc, 161 bool SetAudioSend(uint32_t ssrc,
162 bool enable, 162 bool enable,
163 const AudioOptions* options, 163 const AudioOptions* options,
164 AudioRenderer* renderer) override; 164 AudioSource* source) override;
165 bool AddSendStream(const StreamParams& sp) override; 165 bool AddSendStream(const StreamParams& sp) override;
166 bool RemoveSendStream(uint32_t ssrc) override; 166 bool RemoveSendStream(uint32_t ssrc) override;
167 bool AddRecvStream(const StreamParams& sp) override; 167 bool AddRecvStream(const StreamParams& sp) override;
168 bool RemoveRecvStream(uint32_t ssrc) override; 168 bool RemoveRecvStream(uint32_t ssrc) override;
169 bool GetActiveStreams(AudioInfo::StreamList* actives) override; 169 bool GetActiveStreams(AudioInfo::StreamList* actives) override;
170 int GetOutputLevel() override; 170 int GetOutputLevel() override;
171 int GetTimeSinceLastTyping() override; 171 int GetTimeSinceLastTyping() override;
172 void SetTypingDetectionParameters(int time_window, 172 void SetTypingDetectionParameters(int time_window,
173 int cost_per_typing, 173 int cost_per_typing,
174 int reporting_threshold, 174 int reporting_threshold,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 int GetSendChannelId(uint32_t ssrc) const; 211 int GetSendChannelId(uint32_t ssrc) const;
212 212
213 private: 213 private:
214 bool SetOptions(const AudioOptions& options); 214 bool SetOptions(const AudioOptions& options);
215 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); 215 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
216 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); 216 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
217 bool SetSendCodecs(int channel); 217 bool SetSendCodecs(int channel);
218 void SetNack(int channel, bool nack_enabled); 218 void SetNack(int channel, bool nack_enabled);
219 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); 219 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
220 bool SetMaxSendBandwidth(int bps); 220 bool SetMaxSendBandwidth(int bps);
221 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); 221 bool SetLocalSource(uint32_t ssrc, AudioSource* source);
222 bool MuteStream(uint32_t ssrc, bool mute); 222 bool MuteStream(uint32_t ssrc, bool mute);
223 223
224 WebRtcVoiceEngine* engine() { return engine_; } 224 WebRtcVoiceEngine* engine() { return engine_; }
225 int GetLastEngineError() { return engine()->GetLastEngineError(); } 225 int GetLastEngineError() { return engine()->GetLastEngineError(); }
226 int GetOutputLevel(int channel); 226 int GetOutputLevel(int channel);
227 bool SetPlayout(int channel, bool playout); 227 bool SetPlayout(int channel, bool playout);
228 bool ChangePlayout(bool playout); 228 bool ChangePlayout(bool playout);
229 bool ChangeSend(SendFlags send);
230 bool ChangeSend(int channel, SendFlags send);
231 int CreateVoEChannel(); 229 int CreateVoEChannel();
232 bool DeleteVoEChannel(int channel); 230 bool DeleteVoEChannel(int channel);
233 bool IsDefaultRecvStream(uint32_t ssrc) { 231 bool IsDefaultRecvStream(uint32_t ssrc) {
234 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); 232 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
235 } 233 }
236 bool SetSendBitrateInternal(int bps); 234 bool SetSendBitrateInternal(int bps);
237 bool HasSendCodec() const { 235 bool HasSendCodec() const {
238 return send_codec_spec_.codec_inst.pltype != -1; 236 return send_codec_spec_.codec_inst.pltype != -1;
239 } 237 }
240 238
241 rtc::ThreadChecker worker_thread_checker_; 239 rtc::ThreadChecker worker_thread_checker_;
242 240
243 WebRtcVoiceEngine* const engine_ = nullptr; 241 WebRtcVoiceEngine* const engine_ = nullptr;
244 std::vector<AudioCodec> recv_codecs_; 242 std::vector<AudioCodec> recv_codecs_;
245 bool send_bitrate_setting_ = false; 243 bool send_bitrate_setting_ = false;
246 int send_bitrate_bps_ = 0; 244 int send_bitrate_bps_ = 0;
247 AudioOptions options_; 245 AudioOptions options_;
248 rtc::Optional<int> dtmf_payload_type_; 246 rtc::Optional<int> dtmf_payload_type_;
249 bool desired_playout_ = false; 247 bool desired_playout_ = false;
250 bool recv_transport_cc_enabled_ = false; 248 bool recv_transport_cc_enabled_ = false;
251 bool playout_ = false; 249 bool playout_ = false;
252 SendFlags desired_send_ = SEND_NOTHING; 250 bool send_ = false;
253 SendFlags send_ = SEND_NOTHING;
254 webrtc::Call* const call_ = nullptr; 251 webrtc::Call* const call_ = nullptr;
255 252
256 // SSRC of unsignalled receive stream, or -1 if there isn't one. 253 // SSRC of unsignalled receive stream, or -1 if there isn't one.
257 int64_t default_recv_ssrc_ = -1; 254 int64_t default_recv_ssrc_ = -1;
258 // Volume for unsignalled stream, which may be set before the stream exists. 255 // Volume for unsignalled stream, which may be set before the stream exists.
259 double default_recv_volume_ = 1.0; 256 double default_recv_volume_ = 1.0;
260 // Sink for unsignalled stream, which may be set before the stream exists. 257 // Sink for unsignalled stream, which may be set before the stream exists.
261 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_; 258 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_;
262 // Default SSRC to use for RTCP receiver reports in case of no signaled 259 // Default SSRC to use for RTCP receiver reports in case of no signaled
263 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740 260 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
(...skipping 23 matching lines...) Expand all
287 int cng_payload_type = -1; 284 int cng_payload_type = -1;
288 int cng_plfreq = -1; 285 int cng_plfreq = -1;
289 webrtc::CodecInst codec_inst; 286 webrtc::CodecInst codec_inst;
290 } send_codec_spec_; 287 } send_codec_spec_;
291 288
292 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 289 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
293 }; 290 };
294 } // namespace cricket 291 } // namespace cricket
295 292
296 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 293 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698