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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 rtp_rtcp_modules_[0]->SetREMBStatus(false); | 484 rtp_rtcp_modules_[0]->SetREMBStatus(false); |
485 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); | 485 remb_->RemoveRembSender(rtp_rtcp_modules_[0]); |
486 | 486 |
487 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 487 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
488 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); | 488 congestion_controller_->packet_router()->RemoveRtpModule(rtp_rtcp); |
489 module_process_thread_->DeRegisterModule(rtp_rtcp); | 489 module_process_thread_->DeRegisterModule(rtp_rtcp); |
490 delete rtp_rtcp; | 490 delete rtp_rtcp; |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
| 494 void VideoSendStream::SignalNetworkState(NetworkState state) { |
| 495 // When network goes up, enable RTCP status before setting transmission state. |
| 496 // When it goes down, disable RTCP afterwards. This ensures that any packets |
| 497 // sent due to the network state changed will not be dropped. |
| 498 if (state == kNetworkUp) { |
| 499 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 500 rtp_rtcp->SetRTCPStatus(config_.rtp.rtcp_mode); |
| 501 } |
| 502 vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp); |
| 503 if (state == kNetworkDown) { |
| 504 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 505 rtp_rtcp->SetRTCPStatus(RtcpMode::kOff); |
| 506 } |
| 507 } |
| 508 |
494 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 509 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
495 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 510 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
496 rtp_rtcp->IncomingRtcpPacket(packet, length); | 511 rtp_rtcp->IncomingRtcpPacket(packet, length); |
497 return true; | 512 return true; |
498 } | 513 } |
499 | 514 |
500 void VideoSendStream::Start() { | 515 void VideoSendStream::Start() { |
501 if (payload_router_.active()) | 516 if (payload_router_.active()) |
502 return; | 517 return; |
503 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); | 518 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 772 } |
758 | 773 |
759 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { | 774 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { |
760 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; | 775 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; |
761 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); | 776 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); |
762 } | 777 } |
763 | 778 |
764 return rtp_states; | 779 return rtp_states; |
765 } | 780 } |
766 | 781 |
767 void VideoSendStream::SignalNetworkState(NetworkState state) { | |
768 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | |
769 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode | |
770 : RtcpMode::kOff); | |
771 } | |
772 } | |
773 | |
774 int VideoSendStream::GetPaddingNeededBps() const { | 782 int VideoSendStream::GetPaddingNeededBps() const { |
775 return vie_encoder_.GetPaddingNeededBps(); | 783 return vie_encoder_.GetPaddingNeededBps(); |
776 } | 784 } |
777 | 785 |
778 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 786 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
779 uint8_t fraction_loss, | 787 uint8_t fraction_loss, |
780 int64_t rtt) { | 788 int64_t rtt) { |
781 payload_router_.SetTargetSendBitrate(bitrate_bps); | 789 payload_router_.SetTargetSendBitrate(bitrate_bps); |
782 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); | 790 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); |
783 } | 791 } |
(...skipping 16 matching lines...) Expand all Loading... |
800 &module_nack_rate); | 808 &module_nack_rate); |
801 *sent_video_rate_bps += module_video_rate; | 809 *sent_video_rate_bps += module_video_rate; |
802 *sent_nack_rate_bps += module_nack_rate; | 810 *sent_nack_rate_bps += module_nack_rate; |
803 *sent_fec_rate_bps += module_fec_rate; | 811 *sent_fec_rate_bps += module_fec_rate; |
804 } | 812 } |
805 return 0; | 813 return 0; |
806 } | 814 } |
807 | 815 |
808 } // namespace internal | 816 } // namespace internal |
809 } // namespace webrtc | 817 } // namespace webrtc |
OLD | NEW |