| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 rtp_rtcp_modules_[0]->SetREMBStatus(false); | 480 rtp_rtcp_modules_[0]->SetREMBStatus(false); |
| 481 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | 481 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); |
| 482 | 482 |
| 483 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 483 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 484 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); | 484 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); |
| 485 module_process_thread_->DeRegisterModule(rtp_rtcp); | 485 module_process_thread_->DeRegisterModule(rtp_rtcp); |
| 486 delete rtp_rtcp; | 486 delete rtp_rtcp; |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 void VideoSendStream::SignalNetworkState(NetworkState state) { | |
| 491 // When network goes up, enable RTCP status before setting transmission state. | |
| 492 // When it goes down, disable RTCP afterwards. This ensures that any packets | |
| 493 // sent due to the network state changed will not be dropped. | |
| 494 if (state == kNetworkUp) { | |
| 495 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | |
| 496 rtp_rtcp->SetRTCPStatus(config_.rtp.rtcp_mode); | |
| 497 } | |
| 498 vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp); | |
| 499 if (state == kNetworkDown) { | |
| 500 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | |
| 501 rtp_rtcp->SetRTCPStatus(RtcpMode::kOff); | |
| 502 } | |
| 503 } | |
| 504 | |
| 505 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 490 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 506 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 491 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 507 rtp_rtcp->IncomingRtcpPacket(packet, length); | 492 rtp_rtcp->IncomingRtcpPacket(packet, length); |
| 508 return true; | 493 return true; |
| 509 } | 494 } |
| 510 | 495 |
| 511 void VideoSendStream::Start() { | 496 void VideoSendStream::Start() { |
| 512 if (payload_router_.active()) | 497 if (payload_router_.active()) |
| 513 return; | 498 return; |
| 514 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); | 499 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 } | 721 } |
| 737 | 722 |
| 738 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { | 723 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { |
| 739 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; | 724 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; |
| 740 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); | 725 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); |
| 741 } | 726 } |
| 742 | 727 |
| 743 return rtp_states; | 728 return rtp_states; |
| 744 } | 729 } |
| 745 | 730 |
| 731 void VideoSendStream::SignalNetworkState(NetworkState state) { |
| 732 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 733 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode |
| 734 : RtcpMode::kOff); |
| 735 } |
| 736 } |
| 737 |
| 746 int VideoSendStream::GetPaddingNeededBps() const { | 738 int VideoSendStream::GetPaddingNeededBps() const { |
| 747 return vie_encoder_.GetPaddingNeededBps(); | 739 return vie_encoder_.GetPaddingNeededBps(); |
| 748 } | 740 } |
| 749 | 741 |
| 750 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 742 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
| 751 uint8_t fraction_loss, | 743 uint8_t fraction_loss, |
| 752 int64_t rtt) { | 744 int64_t rtt) { |
| 753 payload_router_.SetTargetSendBitrate(bitrate_bps); | 745 payload_router_.SetTargetSendBitrate(bitrate_bps); |
| 754 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); | 746 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); |
| 755 } | 747 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 772 &module_nack_rate); | 764 &module_nack_rate); |
| 773 *sent_video_rate_bps += module_video_rate; | 765 *sent_video_rate_bps += module_video_rate; |
| 774 *sent_nack_rate_bps += module_nack_rate; | 766 *sent_nack_rate_bps += module_nack_rate; |
| 775 *sent_fec_rate_bps += module_fec_rate; | 767 *sent_fec_rate_bps += module_fec_rate; |
| 776 } | 768 } |
| 777 return 0; | 769 return 0; |
| 778 } | 770 } |
| 779 | 771 |
| 780 } // namespace internal | 772 } // namespace internal |
| 781 } // namespace webrtc | 773 } // namespace webrtc |
| OLD | NEW |