| 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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 | 1343 |
| 1344 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, | 1344 WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel(WebRtcVoiceEngine* engine, |
| 1345 const MediaConfig& config, | 1345 const MediaConfig& config, |
| 1346 const AudioOptions& options, | 1346 const AudioOptions& options, |
| 1347 webrtc::Call* call) | 1347 webrtc::Call* call) |
| 1348 : VoiceMediaChannel(config), engine_(engine), call_(call) { | 1348 : VoiceMediaChannel(config), engine_(engine), call_(call) { |
| 1349 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel"; | 1349 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::WebRtcVoiceMediaChannel"; |
| 1350 RTC_DCHECK(call); | 1350 RTC_DCHECK(call); |
| 1351 engine->RegisterChannel(this); | 1351 engine->RegisterChannel(this); |
| 1352 SetOptions(options); | 1352 SetOptions(options); |
| 1353 call_->SignalChannelNetworkState( |
| 1354 webrtc::MediaType::AUDIO, |
| 1355 webrtc::ChannelNetworkState::CHANNEL_NETWORK_UP); |
| 1353 } | 1356 } |
| 1354 | 1357 |
| 1355 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { | 1358 WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel() { |
| 1356 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1359 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1357 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel"; | 1360 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::~WebRtcVoiceMediaChannel"; |
| 1358 // TODO(solenberg): Should be able to delete the streams directly, without | 1361 // TODO(solenberg): Should be able to delete the streams directly, without |
| 1359 // going through RemoveNnStream(), once stream objects handle | 1362 // going through RemoveNnStream(), once stream objects handle |
| 1360 // all (de)configuration. | 1363 // all (de)configuration. |
| 1361 while (!send_streams_.empty()) { | 1364 while (!send_streams_.empty()) { |
| 1362 RemoveSendStream(send_streams_.begin()->first); | 1365 RemoveSendStream(send_streams_.begin()->first); |
| 1363 } | 1366 } |
| 1364 while (!recv_streams_.empty()) { | 1367 while (!recv_streams_.empty()) { |
| 1365 RemoveRecvStream(recv_streams_.begin()->first); | 1368 RemoveRecvStream(recv_streams_.begin()->first); |
| 1366 } | 1369 } |
| 1367 engine()->UnregisterChannel(this); | 1370 engine()->UnregisterChannel(this); |
| 1371 call_->SignalChannelNetworkState( |
| 1372 webrtc::MediaType::AUDIO, |
| 1373 webrtc::ChannelNetworkState::CHANNEL_NOT_PRESENT); |
| 1368 } | 1374 } |
| 1369 | 1375 |
| 1370 rtc::DiffServCodePoint WebRtcVoiceMediaChannel::PreferredDscp() const { | 1376 rtc::DiffServCodePoint WebRtcVoiceMediaChannel::PreferredDscp() const { |
| 1371 return kAudioDscpValue; | 1377 return kAudioDscpValue; |
| 1372 } | 1378 } |
| 1373 | 1379 |
| 1374 bool WebRtcVoiceMediaChannel::SetSendParameters( | 1380 bool WebRtcVoiceMediaChannel::SetSendParameters( |
| 1375 const AudioSendParameters& params) { | 1381 const AudioSendParameters& params) { |
| 1376 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1382 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1377 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: " | 1383 LOG(LS_INFO) << "WebRtcVoiceMediaChannel::SetSendParameters: " |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 if (bps < codec.rate) { | 2398 if (bps < codec.rate) { |
| 2393 LOG(LS_INFO) << "Failed to set codec " << codec.plname | 2399 LOG(LS_INFO) << "Failed to set codec " << codec.plname |
| 2394 << " to bitrate " << bps << " bps" | 2400 << " to bitrate " << bps << " bps" |
| 2395 << ", requires at least " << codec.rate << " bps."; | 2401 << ", requires at least " << codec.rate << " bps."; |
| 2396 return false; | 2402 return false; |
| 2397 } | 2403 } |
| 2398 return true; | 2404 return true; |
| 2399 } | 2405 } |
| 2400 } | 2406 } |
| 2401 | 2407 |
| 2408 void WebRtcVoiceMediaChannel::OnReadyToSend(bool ready) |
| 2409 { |
| 2410 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); |
| 2411 call_->SignalChannelNetworkState( |
| 2412 webrtc::MediaType::AUDIO, |
| 2413 ready ? |
| 2414 webrtc::ChannelNetworkState::CHANNEL_NETWORK_UP : |
| 2415 webrtc::ChannelNetworkState::CHANNEL_NETWORK_DOWN); |
| 2416 } |
| 2417 |
| 2402 bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) { | 2418 bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) { |
| 2403 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2419 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2404 RTC_DCHECK(info); | 2420 RTC_DCHECK(info); |
| 2405 | 2421 |
| 2406 // Get SSRC and stats for each sender. | 2422 // Get SSRC and stats for each sender. |
| 2407 RTC_DCHECK(info->senders.size() == 0); | 2423 RTC_DCHECK(info->senders.size() == 0); |
| 2408 for (const auto& stream : send_streams_) { | 2424 for (const auto& stream : send_streams_) { |
| 2409 webrtc::AudioSendStream::Stats stats = stream.second->GetStats(); | 2425 webrtc::AudioSendStream::Stats stats = stream.second->GetStats(); |
| 2410 VoiceSenderInfo sinfo; | 2426 VoiceSenderInfo sinfo; |
| 2411 sinfo.add_ssrc(stats.local_ssrc); | 2427 sinfo.add_ssrc(stats.local_ssrc); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 } | 2536 } |
| 2521 } else { | 2537 } else { |
| 2522 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2538 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
| 2523 engine()->voe()->base()->StopPlayout(channel); | 2539 engine()->voe()->base()->StopPlayout(channel); |
| 2524 } | 2540 } |
| 2525 return true; | 2541 return true; |
| 2526 } | 2542 } |
| 2527 } // namespace cricket | 2543 } // namespace cricket |
| 2528 | 2544 |
| 2529 #endif // HAVE_WEBRTC_VOICE | 2545 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |