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

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 1972183004: Reland "Remove ViEEncoder::SetNetworkStatus" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix bug in BitrateAllocator::Allocate(bitrate) Created 4 years, 7 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
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 758 }
774 759
775 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { 760 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) {
776 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; 761 uint32_t ssrc = config_.rtp.rtx.ssrcs[i];
777 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); 762 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState();
778 } 763 }
779 764
780 return rtp_states; 765 return rtp_states;
781 } 766 }
782 767
768 void VideoSendStream::SignalNetworkState(NetworkState state) {
769 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
770 rtp_rtcp->SetRTCPStatus(state == kNetworkUp ? config_.rtp.rtcp_mode
771 : RtcpMode::kOff);
772 }
773 }
774
783 int VideoSendStream::GetPaddingNeededBps() const { 775 int VideoSendStream::GetPaddingNeededBps() const {
784 return vie_encoder_.GetPaddingNeededBps(); 776 return vie_encoder_.GetPaddingNeededBps();
785 } 777 }
786 778
787 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, 779 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
788 uint8_t fraction_loss, 780 uint8_t fraction_loss,
789 int64_t rtt) { 781 int64_t rtt) {
790 payload_router_.SetTargetSendBitrate(bitrate_bps); 782 payload_router_.SetTargetSendBitrate(bitrate_bps);
791 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); 783 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt);
792 } 784 }
(...skipping 16 matching lines...) Expand all
809 &module_nack_rate); 801 &module_nack_rate);
810 *sent_video_rate_bps += module_video_rate; 802 *sent_video_rate_bps += module_video_rate;
811 *sent_nack_rate_bps += module_nack_rate; 803 *sent_nack_rate_bps += module_nack_rate;
812 *sent_fec_rate_bps += module_fec_rate; 804 *sent_fec_rate_bps += module_fec_rate;
813 } 805 }
814 return 0; 806 return 0;
815 } 807 }
816 808
817 } // namespace internal 809 } // namespace internal
818 } // namespace webrtc 810 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698