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