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 | |
509 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 494 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
510 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 495 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
511 rtp_rtcp->IncomingRtcpPacket(packet, length); | 496 rtp_rtcp->IncomingRtcpPacket(packet, length); |
512 return true; | 497 return true; |
513 } | 498 } |
514 | 499 |
515 void VideoSendStream::Start() { | 500 void VideoSendStream::Start() { |
516 if (payload_router_.active()) | 501 if (payload_router_.active()) |
517 return; | 502 return; |
518 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); | 503 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } | 757 } |
773 | 758 |
774 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { | 759 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { |
775 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; | 760 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; |
776 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); | 761 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); |
777 } | 762 } |
778 | 763 |
779 return rtp_states; | 764 return rtp_states; |
780 } | 765 } |
781 | 766 |
| 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 |
782 int VideoSendStream::GetPaddingNeededBps() const { | 774 int VideoSendStream::GetPaddingNeededBps() const { |
783 return vie_encoder_.GetPaddingNeededBps(); | 775 return vie_encoder_.GetPaddingNeededBps(); |
784 } | 776 } |
785 | 777 |
786 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 778 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
787 uint8_t fraction_loss, | 779 uint8_t fraction_loss, |
788 int64_t rtt) { | 780 int64_t rtt) { |
789 payload_router_.SetTargetSendBitrate(bitrate_bps); | 781 payload_router_.SetTargetSendBitrate(bitrate_bps); |
790 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); | 782 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); |
791 } | 783 } |
(...skipping 16 matching lines...) Expand all Loading... |
808 &module_nack_rate); | 800 &module_nack_rate); |
809 *sent_video_rate_bps += module_video_rate; | 801 *sent_video_rate_bps += module_video_rate; |
810 *sent_nack_rate_bps += module_nack_rate; | 802 *sent_nack_rate_bps += module_nack_rate; |
811 *sent_fec_rate_bps += module_fec_rate; | 803 *sent_fec_rate_bps += module_fec_rate; |
812 } | 804 } |
813 return 0; | 805 return 0; |
814 } | 806 } |
815 | 807 |
816 } // namespace internal | 808 } // namespace internal |
817 } // namespace webrtc | 809 } // namespace webrtc |
OLD | NEW |