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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 // Accessor to the VoE channel ID. | 1208 // Accessor to the VoE channel ID. |
1209 int channel() const { | 1209 int channel() const { |
1210 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1210 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1211 return config_.voe_channel_id; | 1211 return config_.voe_channel_id; |
1212 } | 1212 } |
1213 | 1213 |
1214 const webrtc::RtpParameters& rtp_parameters() const { | 1214 const webrtc::RtpParameters& rtp_parameters() const { |
1215 return rtp_parameters_; | 1215 return rtp_parameters_; |
1216 } | 1216 } |
1217 | 1217 |
1218 void set_rtp_parameters(const webrtc::RtpParameters& parameters) { | 1218 void SetRtpParameters(const webrtc::RtpParameters& parameters) { |
1219 RTC_CHECK_EQ(1UL, parameters.encodings.size()); | 1219 RTC_CHECK_EQ(1UL, parameters.encodings.size()); |
1220 rtp_parameters_ = parameters; | 1220 rtp_parameters_ = parameters; |
1221 // parameters.encodings[0].active could have changed. | |
1222 UpdateSendState(); | |
1221 } | 1223 } |
1222 | 1224 |
1223 private: | 1225 private: |
1224 void UpdateSendState() { | 1226 void UpdateSendState() { |
1225 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1227 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1226 RTC_DCHECK(stream_); | 1228 RTC_DCHECK(stream_); |
1227 if (send_ && source_ != nullptr) { | 1229 RTC_DCHECK(rtp_parameters_.encodings.size() == 1u); |
the sun
2016/05/03 08:14:04
nit: use .._EQ like above
| |
1230 if (send_ && source_ != nullptr && rtp_parameters_.encodings[0].active) { | |
1228 stream_->Start(); | 1231 stream_->Start(); |
1229 } else { // !send || source_ = nullptr | 1232 } else { // !send || source_ = nullptr |
1230 stream_->Stop(); | 1233 stream_->Stop(); |
1231 } | 1234 } |
1232 } | 1235 } |
1233 | 1236 |
1234 rtc::ThreadChecker worker_thread_checker_; | 1237 rtc::ThreadChecker worker_thread_checker_; |
1235 rtc::ThreadChecker audio_capture_thread_checker_; | 1238 rtc::ThreadChecker audio_capture_thread_checker_; |
1236 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; | 1239 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; |
1237 webrtc::Call* call_ = nullptr; | 1240 webrtc::Call* call_ = nullptr; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1449 return false; | 1452 return false; |
1450 } | 1453 } |
1451 | 1454 |
1452 if (!SetChannelParameters(it->second->channel(), parameters)) { | 1455 if (!SetChannelParameters(it->second->channel(), parameters)) { |
1453 LOG(LS_WARNING) << "Failed to set RtpParameters."; | 1456 LOG(LS_WARNING) << "Failed to set RtpParameters."; |
1454 return false; | 1457 return false; |
1455 } | 1458 } |
1456 // Codecs are handled at the WebRtcVoiceMediaChannel level. | 1459 // Codecs are handled at the WebRtcVoiceMediaChannel level. |
1457 webrtc::RtpParameters reduced_params = parameters; | 1460 webrtc::RtpParameters reduced_params = parameters; |
1458 reduced_params.codecs.clear(); | 1461 reduced_params.codecs.clear(); |
1459 it->second->set_rtp_parameters(reduced_params); | 1462 it->second->SetRtpParameters(reduced_params); |
1460 return true; | 1463 return true; |
1461 } | 1464 } |
1462 | 1465 |
1463 bool WebRtcVoiceMediaChannel::ValidateRtpParameters( | 1466 bool WebRtcVoiceMediaChannel::ValidateRtpParameters( |
1464 const webrtc::RtpParameters& rtp_parameters) { | 1467 const webrtc::RtpParameters& rtp_parameters) { |
1465 if (rtp_parameters.encodings.size() != 1) { | 1468 if (rtp_parameters.encodings.size() != 1) { |
1466 LOG(LS_ERROR) | 1469 LOG(LS_ERROR) |
1467 << "Attempted to set RtpParameters without exactly one encoding"; | 1470 << "Attempted to set RtpParameters without exactly one encoding"; |
1468 return false; | 1471 return false; |
1469 } | 1472 } |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2594 } | 2597 } |
2595 } else { | 2598 } else { |
2596 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2599 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2597 engine()->voe()->base()->StopPlayout(channel); | 2600 engine()->voe()->base()->StopPlayout(channel); |
2598 } | 2601 } |
2599 return true; | 2602 return true; |
2600 } | 2603 } |
2601 } // namespace cricket | 2604 } // namespace cricket |
2602 | 2605 |
2603 #endif // HAVE_WEBRTC_VOICE | 2606 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |