| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 void SetPlayout(bool playout) { | 1417 void SetPlayout(bool playout) { |
| 1418 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1418 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1419 RTC_DCHECK(stream_); | 1419 RTC_DCHECK(stream_); |
| 1420 if (playout) { | 1420 if (playout) { |
| 1421 LOG(LS_INFO) << "Starting playout for channel #" << channel(); | 1421 LOG(LS_INFO) << "Starting playout for channel #" << channel(); |
| 1422 stream_->Start(); | 1422 stream_->Start(); |
| 1423 } else { | 1423 } else { |
| 1424 LOG(LS_INFO) << "Stopping playout for channel #" << channel(); | 1424 LOG(LS_INFO) << "Stopping playout for channel #" << channel(); |
| 1425 stream_->Stop(); | 1425 stream_->Stop(); |
| 1426 } | 1426 } |
| 1427 playout_ = playout; |
| 1427 } | 1428 } |
| 1428 | 1429 |
| 1429 private: | 1430 private: |
| 1430 void RecreateAudioReceiveStream( | 1431 void RecreateAudioReceiveStream( |
| 1431 uint32_t local_ssrc, | 1432 uint32_t local_ssrc, |
| 1432 bool use_transport_cc, | 1433 bool use_transport_cc, |
| 1433 bool use_nack, | 1434 bool use_nack, |
| 1434 const std::vector<webrtc::RtpExtension>& extensions) { | 1435 const std::vector<webrtc::RtpExtension>& extensions) { |
| 1435 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1436 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1436 if (stream_) { | 1437 if (stream_) { |
| 1437 call_->DestroyAudioReceiveStream(stream_); | 1438 call_->DestroyAudioReceiveStream(stream_); |
| 1438 stream_ = nullptr; | 1439 stream_ = nullptr; |
| 1439 } | 1440 } |
| 1440 config_.rtp.local_ssrc = local_ssrc; | 1441 config_.rtp.local_ssrc = local_ssrc; |
| 1441 config_.rtp.transport_cc = use_transport_cc; | 1442 config_.rtp.transport_cc = use_transport_cc; |
| 1442 config_.rtp.nack.rtp_history_ms = use_nack ? kNackRtpHistoryMs : 0; | 1443 config_.rtp.nack.rtp_history_ms = use_nack ? kNackRtpHistoryMs : 0; |
| 1443 config_.rtp.extensions = extensions; | 1444 config_.rtp.extensions = extensions; |
| 1444 RTC_DCHECK(!stream_); | 1445 RTC_DCHECK(!stream_); |
| 1445 stream_ = call_->CreateAudioReceiveStream(config_); | 1446 stream_ = call_->CreateAudioReceiveStream(config_); |
| 1446 RTC_CHECK(stream_); | 1447 RTC_CHECK(stream_); |
| 1448 SetPlayout(playout_); |
| 1447 } | 1449 } |
| 1448 | 1450 |
| 1449 rtc::ThreadChecker worker_thread_checker_; | 1451 rtc::ThreadChecker worker_thread_checker_; |
| 1450 webrtc::Call* call_ = nullptr; | 1452 webrtc::Call* call_ = nullptr; |
| 1451 webrtc::AudioReceiveStream::Config config_; | 1453 webrtc::AudioReceiveStream::Config config_; |
| 1452 // The stream is owned by WebRtcAudioReceiveStream and may be reallocated if | 1454 // The stream is owned by WebRtcAudioReceiveStream and may be reallocated if |
| 1453 // configuration changes. | 1455 // configuration changes. |
| 1454 webrtc::AudioReceiveStream* stream_ = nullptr; | 1456 webrtc::AudioReceiveStream* stream_ = nullptr; |
| 1457 bool playout_ = false; |
| 1455 | 1458 |
| 1456 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioReceiveStream); | 1459 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioReceiveStream); |
| 1457 }; | 1460 }; |
| 1458 | 1461 |
| 1459 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 1462 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
| 1460 const MediaConfig& config, | 1463 const MediaConfig& config, |
| 1461 const AudioOptions& options, | 1464 const AudioOptions& options, |
| 1462 webrtc::Call* call) | 1465 webrtc::Call* call) |
| 1463 : VoiceMediaChannel(config), engine_(engine), call_(call) { | 1466 : VoiceMediaChannel(config), engine_(engine), call_(call) { |
| 1464 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel"; | 1467 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel"; |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2661 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2664 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2662 const auto it = send_streams_.find(ssrc); | 2665 const auto it = send_streams_.find(ssrc); |
| 2663 if (it != send_streams_.end()) { | 2666 if (it != send_streams_.end()) { |
| 2664 return it->second->channel(); | 2667 return it->second->channel(); |
| 2665 } | 2668 } |
| 2666 return -1; | 2669 return -1; |
| 2667 } | 2670 } |
| 2668 } // namespace cricket | 2671 } // namespace cricket |
| 2669 | 2672 |
| 2670 #endif // HAVE_WEBRTC_VOICE | 2673 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |