OLD | NEW |
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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 webrtc::RtpParameters WebRtcVoiceMediaChannel::GetRtpParameters( | 1411 webrtc::RtpParameters WebRtcVoiceMediaChannel::GetRtpParameters( |
1412 uint32_t ssrc) const { | 1412 uint32_t ssrc) const { |
1413 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1413 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1414 auto it = send_streams_.find(ssrc); | 1414 auto it = send_streams_.find(ssrc); |
1415 if (it == send_streams_.end()) { | 1415 if (it == send_streams_.end()) { |
1416 LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc " | 1416 LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc " |
1417 << ssrc << " which doesn't exist."; | 1417 << ssrc << " which doesn't exist."; |
1418 return webrtc::RtpParameters(); | 1418 return webrtc::RtpParameters(); |
1419 } | 1419 } |
1420 | 1420 |
1421 return it->second->rtp_parameters(); | 1421 webrtc::RtpParameters rtp_params = it->second->rtp_parameters(); |
| 1422 // Need to add the common list of codecs to the send stream-specific |
| 1423 // RTP parameters. |
| 1424 for (const AudioCodec& codec : send_codecs_) { |
| 1425 webrtc::RtpCodecParameters codec_params; |
| 1426 codec_params.payload_type = codec.id; |
| 1427 codec_params.mime_type = codec.name; |
| 1428 codec_params.clock_rate = codec.clockrate; |
| 1429 codec_params.channels = codec.channels; |
| 1430 rtp_params.codecs.push_back(codec_params); |
| 1431 } |
| 1432 return rtp_params; |
1422 } | 1433 } |
1423 | 1434 |
1424 bool WebRtcVoiceMediaChannel::SetRtpParameters( | 1435 bool WebRtcVoiceMediaChannel::SetRtpParameters( |
1425 uint32_t ssrc, | 1436 uint32_t ssrc, |
1426 const webrtc::RtpParameters& parameters) { | 1437 const webrtc::RtpParameters& parameters) { |
1427 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1438 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1428 if (!ValidateRtpParameters(parameters)) { | 1439 if (!ValidateRtpParameters(parameters)) { |
1429 return false; | 1440 return false; |
1430 } | 1441 } |
1431 auto it = send_streams_.find(ssrc); | 1442 auto it = send_streams_.find(ssrc); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 // and in that case reconfigure all receive streams. | 1674 // and in that case reconfigure all receive streams. |
1664 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled) { | 1675 if (recv_transport_cc_enabled_ != send_codec_spec_.transport_cc_enabled) { |
1665 LOG(LS_INFO) << "Recreate all the receive streams because the send " | 1676 LOG(LS_INFO) << "Recreate all the receive streams because the send " |
1666 "codec has changed."; | 1677 "codec has changed."; |
1667 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled; | 1678 recv_transport_cc_enabled_ = send_codec_spec_.transport_cc_enabled; |
1668 for (auto& kv : recv_streams_) { | 1679 for (auto& kv : recv_streams_) { |
1669 kv.second->RecreateAudioReceiveStream(recv_transport_cc_enabled_); | 1680 kv.second->RecreateAudioReceiveStream(recv_transport_cc_enabled_); |
1670 } | 1681 } |
1671 } | 1682 } |
1672 | 1683 |
| 1684 send_codecs_ = codecs; |
1673 return true; | 1685 return true; |
1674 } | 1686 } |
1675 | 1687 |
1676 // Apply current codec settings to a single voe::Channel used for sending. | 1688 // Apply current codec settings to a single voe::Channel used for sending. |
1677 bool WebRtcVoiceMediaChannel::SetSendCodecs( | 1689 bool WebRtcVoiceMediaChannel::SetSendCodecs( |
1678 int channel, | 1690 int channel, |
1679 const webrtc::RtpParameters& rtp_parameters) { | 1691 const webrtc::RtpParameters& rtp_parameters) { |
1680 // Disable VAD, FEC, and RED unless we know the other side wants them. | 1692 // Disable VAD, FEC, and RED unless we know the other side wants them. |
1681 engine()->voe()->codec()->SetVADStatus(channel, false); | 1693 engine()->voe()->codec()->SetVADStatus(channel, false); |
1682 engine()->voe()->rtp()->SetNACKStatus(channel, false, 0); | 1694 engine()->voe()->rtp()->SetNACKStatus(channel, false, 0); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 return false; | 2394 return false; |
2383 } | 2395 } |
2384 } | 2396 } |
2385 return true; | 2397 return true; |
2386 } | 2398 } |
2387 | 2399 |
2388 bool WebRtcVoiceMediaChannel::SetChannelParameters( | 2400 bool WebRtcVoiceMediaChannel::SetChannelParameters( |
2389 int channel, | 2401 int channel, |
2390 const webrtc::RtpParameters& parameters) { | 2402 const webrtc::RtpParameters& parameters) { |
2391 RTC_CHECK_EQ(1UL, parameters.encodings.size()); | 2403 RTC_CHECK_EQ(1UL, parameters.encodings.size()); |
| 2404 // TODO(deadbeef): Handle setting parameters with a list of codecs in a |
| 2405 // different order (which should change the send codec). |
2392 return SetSendBitrate( | 2406 return SetSendBitrate( |
2393 channel, | 2407 channel, |
2394 MinPositive(send_bitrate_bps_, parameters.encodings[0].max_bitrate_bps)); | 2408 MinPositive(send_bitrate_bps_, parameters.encodings[0].max_bitrate_bps)); |
2395 } | 2409 } |
2396 | 2410 |
2397 bool WebRtcVoiceMediaChannel::SetSendBitrate(int channel, int bps) { | 2411 bool WebRtcVoiceMediaChannel::SetSendBitrate(int channel, int bps) { |
2398 // Bitrate is auto by default. | 2412 // Bitrate is auto by default. |
2399 // TODO(bemasc): Fix this so that if SetMaxSendBandwidth(50) is followed by | 2413 // TODO(bemasc): Fix this so that if SetMaxSendBandwidth(50) is followed by |
2400 // SetMaxSendBandwith(0), the second call removes the previous limit. | 2414 // SetMaxSendBandwith(0), the second call removes the previous limit. |
2401 if (bps <= 0) | 2415 if (bps <= 0) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 } | 2576 } |
2563 } else { | 2577 } else { |
2564 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2578 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2565 engine()->voe()->base()->StopPlayout(channel); | 2579 engine()->voe()->base()->StopPlayout(channel); |
2566 } | 2580 } |
2567 return true; | 2581 return true; |
2568 } | 2582 } |
2569 } // namespace cricket | 2583 } // namespace cricket |
2570 | 2584 |
2571 #endif // HAVE_WEBRTC_VOICE | 2585 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |