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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1757683002: Make the audio channel communicate network state changes to the call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Made the Call class keep track of network state for audio and video separately 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 external_decoder_factory_(external_decoder_factory) { 618 external_decoder_factory_(external_decoder_factory) {
619 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 619 RTC_DCHECK(thread_checker_.CalledOnValidThread());
620 620
621 send_params_.options = options; 621 send_params_.options = options;
622 622
623 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc; 623 rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
624 sending_ = false; 624 sending_ = false;
625 default_send_ssrc_ = 0; 625 default_send_ssrc_ = 0;
626 RTC_DCHECK(ValidateCodecFormats(recv_codecs)); 626 RTC_DCHECK(ValidateCodecFormats(recv_codecs));
627 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs)); 627 recv_codecs_ = FilterSupportedCodecs(MapCodecs(recv_codecs));
628 call_->SignalChannelNetworkState(
629 webrtc::MediaType::VIDEO,
630 webrtc::ChannelNetworkState::CHANNEL_NETWORK_UP);
the sun 2016/03/04 12:40:48 I'd think Call can already figure this out since i
628 } 631 }
629 632
630 WebRtcVideoChannel2::~WebRtcVideoChannel2() { 633 WebRtcVideoChannel2::~WebRtcVideoChannel2() {
631 for (auto& kv : send_streams_) 634 for (auto& kv : send_streams_)
632 delete kv.second; 635 delete kv.second;
633 for (auto& kv : receive_streams_) 636 for (auto& kv : receive_streams_)
634 delete kv.second; 637 delete kv.second;
638 call_->SignalChannelNetworkState(
the sun 2016/03/04 12:40:48 Likewise.
639 webrtc::MediaType::VIDEO,
640 webrtc::ChannelNetworkState::CHANNEL_NOT_PRESENT);
635 } 641 }
636 642
637 bool WebRtcVideoChannel2::CodecIsExternallySupported( 643 bool WebRtcVideoChannel2::CodecIsExternallySupported(
638 const std::string& name) const { 644 const std::string& name) const {
639 if (external_encoder_factory_ == NULL) { 645 if (external_encoder_factory_ == NULL) {
640 return false; 646 return false;
641 } 647 }
642 648
643 const std::vector<WebRtcVideoEncoderFactory::VideoCodec> external_codecs = 649 const std::vector<WebRtcVideoEncoderFactory::VideoCodec> external_codecs =
644 external_encoder_factory_->codecs(); 650 external_encoder_factory_->codecs();
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 // filter RTCP anymore incoming RTCP packets could've been going to audio (so 1359 // filter RTCP anymore incoming RTCP packets could've been going to audio (so
1354 // logging failures spam the log). 1360 // logging failures spam the log).
1355 call_->Receiver()->DeliverPacket( 1361 call_->Receiver()->DeliverPacket(
1356 webrtc::MediaType::VIDEO, 1362 webrtc::MediaType::VIDEO,
1357 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(), 1363 reinterpret_cast<const uint8_t*>(packet->data()), packet->size(),
1358 webrtc_packet_time); 1364 webrtc_packet_time);
1359 } 1365 }
1360 1366
1361 void WebRtcVideoChannel2::OnReadyToSend(bool ready) { 1367 void WebRtcVideoChannel2::OnReadyToSend(bool ready) {
1362 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready."); 1368 LOG(LS_VERBOSE) << "OnReadyToSend: " << (ready ? "Ready." : "Not ready.");
1363 call_->SignalNetworkState(ready ? webrtc::kNetworkUp : webrtc::kNetworkDown); 1369 call_->SignalChannelNetworkState(
1370 webrtc::MediaType::VIDEO,
1371 ready ?
1372 webrtc::ChannelNetworkState::CHANNEL_NETWORK_UP :
1373 webrtc::ChannelNetworkState::CHANNEL_NETWORK_DOWN);
1364 } 1374 }
1365 1375
1366 bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) { 1376 bool WebRtcVideoChannel2::MuteStream(uint32_t ssrc, bool mute) {
1367 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> " 1377 LOG(LS_VERBOSE) << "MuteStream: " << ssrc << " -> "
1368 << (mute ? "mute" : "unmute"); 1378 << (mute ? "mute" : "unmute");
1369 RTC_DCHECK(ssrc != 0); 1379 RTC_DCHECK(ssrc != 0);
1370 rtc::CritScope stream_lock(&stream_crit_); 1380 rtc::CritScope stream_lock(&stream_crit_);
1371 const auto& kv = send_streams_.find(ssrc); 1381 const auto& kv = send_streams_.find(ssrc);
1372 if (kv == send_streams_.end()) { 1382 if (kv == send_streams_.end()) {
1373 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc; 1383 LOG(LS_ERROR) << "No sending stream on ssrc " << ssrc;
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 rtx_mapping[video_codecs[i].codec.id] != 2544 rtx_mapping[video_codecs[i].codec.id] !=
2535 fec_settings.red_payload_type) { 2545 fec_settings.red_payload_type) {
2536 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2546 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2537 } 2547 }
2538 } 2548 }
2539 2549
2540 return video_codecs; 2550 return video_codecs;
2541 } 2551 }
2542 2552
2543 } // namespace cricket 2553 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698