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

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: Fixing patch conflict. 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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool SetSend(SendFlags 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 int GetReceiveChannelId(uint32_t ssrc) const; 210 int GetReceiveChannelId(uint32_t ssrc) const;
211 int GetSendChannelId(uint32_t ssrc) const; 211 int GetSendChannelId(uint32_t ssrc) const;
212 212
213 private: 213 private:
214 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); 214 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
215 bool SetOptions(const AudioOptions& options); 215 bool SetOptions(const AudioOptions& options);
216 bool SetMaxSendBandwidth(int bps); 216 bool SetMaxSendBandwidth(int bps);
217 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs); 217 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
218 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); 218 bool SetLocalSource(uint32_t ssrc, AudioSource* source);
219 bool MuteStream(uint32_t ssrc, bool mute); 219 bool MuteStream(uint32_t ssrc, bool mute);
220 220
221 WebRtcVoiceEngine* engine() { return engine_; } 221 WebRtcVoiceEngine* engine() { return engine_; }
222 int GetLastEngineError() { return engine()->GetLastEngineError(); } 222 int GetLastEngineError() { return engine()->GetLastEngineError(); }
223 int GetOutputLevel(int channel); 223 int GetOutputLevel(int channel);
224 bool SetPlayout(int channel, bool playout); 224 bool SetPlayout(int channel, bool playout);
225 void SetNack(int channel, bool nack_enabled); 225 void SetNack(int channel, bool nack_enabled);
226 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec); 226 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
227 bool ChangePlayout(bool playout); 227 bool ChangePlayout(bool playout);
228 bool ChangeSend(SendFlags send); 228 // Update the send state for the channel associated with |ssrc|,
229 bool ChangeSend(int channel, SendFlags send); 229 // according to |send| and whether or not the send stream is rendering.
230 bool UpdateChannelSendState(uint32_t ssrc, SendFlags send);
230 int CreateVoEChannel(); 231 int CreateVoEChannel();
231 bool DeleteVoEChannel(int channel); 232 bool DeleteVoEChannel(int channel);
232 bool IsDefaultRecvStream(uint32_t ssrc) { 233 bool IsDefaultRecvStream(uint32_t ssrc) {
233 return default_recv_ssrc_ == static_cast<int64_t>(ssrc); 234 return default_recv_ssrc_ == static_cast<int64_t>(ssrc);
234 } 235 }
235 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs); 236 bool SetSendCodecs(int channel, const std::vector<AudioCodec>& codecs);
236 bool SetSendBitrateInternal(int bps); 237 bool SetSendBitrateInternal(int bps);
237 238
238 rtc::ThreadChecker worker_thread_checker_; 239 rtc::ThreadChecker worker_thread_checker_;
239 240
240 WebRtcVoiceEngine* const engine_ = nullptr; 241 WebRtcVoiceEngine* const engine_ = nullptr;
241 std::vector<AudioCodec> recv_codecs_; 242 std::vector<AudioCodec> recv_codecs_;
242 std::vector<AudioCodec> send_codecs_; 243 std::vector<AudioCodec> send_codecs_;
243 std::unique_ptr<webrtc::CodecInst> send_codec_; 244 std::unique_ptr<webrtc::CodecInst> send_codec_;
244 bool send_bitrate_setting_ = false; 245 bool send_bitrate_setting_ = false;
245 int send_bitrate_bps_ = 0; 246 int send_bitrate_bps_ = 0;
246 AudioOptions options_; 247 AudioOptions options_;
247 rtc::Optional<int> dtmf_payload_type_; 248 rtc::Optional<int> dtmf_payload_type_;
248 bool desired_playout_ = false; 249 bool desired_playout_ = false;
249 bool nack_enabled_ = false; 250 bool nack_enabled_ = false;
250 bool transport_cc_enabled_ = false; 251 bool transport_cc_enabled_ = false;
251 bool playout_ = false; 252 bool playout_ = false;
252 SendFlags desired_send_ = SEND_NOTHING;
253 SendFlags send_ = SEND_NOTHING; 253 SendFlags send_ = SEND_NOTHING;
254 webrtc::Call* const call_ = nullptr; 254 webrtc::Call* const call_ = nullptr;
255 255
256 // SSRC of unsignalled receive stream, or -1 if there isn't one. 256 // SSRC of unsignalled receive stream, or -1 if there isn't one.
257 int64_t default_recv_ssrc_ = -1; 257 int64_t default_recv_ssrc_ = -1;
258 // Volume for unsignalled stream, which may be set before the stream exists. 258 // Volume for unsignalled stream, which may be set before the stream exists.
259 double default_recv_volume_ = 1.0; 259 double default_recv_volume_ = 1.0;
260 // Sink for unsignalled stream, which may be set before the stream exists. 260 // Sink for unsignalled stream, which may be set before the stream exists.
261 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_; 261 std::unique_ptr<webrtc::AudioSinkInterface> default_sink_;
262 // Default SSRC to use for RTCP receiver reports in case of no signaled 262 // 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 263 // send streams. See: https://code.google.com/p/webrtc/issues/detail?id=4740
264 // and https://code.google.com/p/chromium/issues/detail?id=547661 264 // and https://code.google.com/p/chromium/issues/detail?id=547661
265 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u; 265 uint32_t receiver_reports_ssrc_ = 0xFA17FA17u;
266 266
267 class WebRtcAudioSendStream; 267 class WebRtcAudioSendStream;
268 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_; 268 std::map<uint32_t, WebRtcAudioSendStream*> send_streams_;
269 std::vector<webrtc::RtpExtension> send_rtp_extensions_; 269 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
270 270
271 class WebRtcAudioReceiveStream; 271 class WebRtcAudioReceiveStream;
272 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_; 272 std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
273 std::vector<webrtc::RtpExtension> recv_rtp_extensions_; 273 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
274 274
275 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 275 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
276 }; 276 };
277 } // namespace cricket 277 } // namespace cricket
278 278
279 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 279 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698