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

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

Issue 1765873002: On WVoMC::SetSendParameters(), figure out send codec settings ONCE, not for each send stream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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 | « no previous file | 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 bool SendRtcp(const uint8_t* data, size_t len) override { 204 bool SendRtcp(const uint8_t* data, size_t len) override {
205 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len, 205 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len,
206 kMaxRtpPacketLen); 206 kMaxRtpPacketLen);
207 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions()); 207 return VoiceMediaChannel::SendRtcp(&packet, rtc::PacketOptions());
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 SetOptions(const AudioOptions& options);
215 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
214 bool SetSendCodecs(const std::vector<AudioCodec>& codecs); 216 bool SetSendCodecs(const std::vector<AudioCodec>& codecs);
215 bool SetOptions(const AudioOptions& options); 217 bool SetSendCodecs(int channel);
218 void SetNack(int channel, bool nack_enabled);
219 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
216 bool SetMaxSendBandwidth(int bps); 220 bool SetMaxSendBandwidth(int bps);
217 bool SetRecvCodecs(const std::vector<AudioCodec>& codecs);
218 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer); 221 bool SetLocalRenderer(uint32_t ssrc, AudioRenderer* renderer);
219 bool MuteStream(uint32_t ssrc, bool mute); 222 bool MuteStream(uint32_t ssrc, bool mute);
220 223
221 WebRtcVoiceEngine* engine() { return engine_; } 224 WebRtcVoiceEngine* engine() { return engine_; }
222 int GetLastEngineError() { return engine()->GetLastEngineError(); } 225 int GetLastEngineError() { return engine()->GetLastEngineError(); }
223 int GetOutputLevel(int channel); 226 int GetOutputLevel(int channel);
224 bool SetPlayout(int channel, bool playout); 227 bool SetPlayout(int channel, bool playout);
225 void SetNack(int channel, bool nack_enabled);
226 bool SetSendCodec(int channel, const webrtc::CodecInst& send_codec);
227 bool ChangePlayout(bool playout); 228 bool ChangePlayout(bool playout);
228 bool ChangeSend(SendFlags send); 229 bool ChangeSend(SendFlags send);
229 bool ChangeSend(int channel, SendFlags send); 230 bool ChangeSend(int channel, 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 SetSendBitrateInternal(int bps); 236 bool SetSendBitrateInternal(int bps);
237 bool HasSendCodec() const {
238 return send_codec_spec_.codec_inst.pltype != -1;
239 }
237 240
238 rtc::ThreadChecker worker_thread_checker_; 241 rtc::ThreadChecker worker_thread_checker_;
239 242
240 WebRtcVoiceEngine* const engine_ = nullptr; 243 WebRtcVoiceEngine* const engine_ = nullptr;
241 std::vector<AudioCodec> recv_codecs_; 244 std::vector<AudioCodec> recv_codecs_;
242 std::vector<AudioCodec> send_codecs_;
243 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 recv_transport_cc_enabled_ = false;
250 bool transport_cc_enabled_ = false;
251 bool playout_ = false; 251 bool playout_ = false;
252 SendFlags desired_send_ = SEND_NOTHING; 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 struct SendCodecSpec {
276 SendCodecSpec() {
277 webrtc::CodecInst empty_inst = {0};
278 codec_inst = empty_inst;
279 codec_inst.pltype = -1;
280 }
281 bool nack_enabled = false;
282 bool transport_cc_enabled = false;
283 bool enable_codec_fec = false;
284 bool enable_opus_dtx = false;
285 int opus_max_playback_rate = 0;
286 int red_payload_type = -1;
287 int cng_payload_type = -1;
288 int cng_plfreq = -1;
289 webrtc::CodecInst codec_inst;
290 } send_codec_spec_;
291
275 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel); 292 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceMediaChannel);
276 }; 293 };
277 } // namespace cricket 294 } // namespace cricket
278 295
279 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_ 296 #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/engine/webrtcvoiceengine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698