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

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

Issue 1924793002: Remove webrtc/stream.h and unutilized inheritance. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: re-rebase 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/video_send_stream.h ('k') | webrtc/video_receive_stream.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 VideoCaptureInput* VideoSendStream::Input() { 494 void VideoSendStream::SignalNetworkState(NetworkState state) {
495 return &input_; 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) {
510 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
511 rtp_rtcp->IncomingRtcpPacket(packet, length);
512 return true;
496 } 513 }
497 514
498 void VideoSendStream::Start() { 515 void VideoSendStream::Start() {
499 if (payload_router_.active()) 516 if (payload_router_.active())
500 return; 517 return;
501 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start"); 518 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start");
502 vie_encoder_.Pause(); 519 vie_encoder_.Pause();
503 payload_router_.set_active(true); 520 payload_router_.set_active(true);
504 // Was not already started, trigger a keyframe. 521 // Was not already started, trigger a keyframe.
505 vie_encoder_.SendKeyFrame(); 522 vie_encoder_.SendKeyFrame();
506 vie_encoder_.Restart(); 523 vie_encoder_.Restart();
507 } 524 }
508 525
509 void VideoSendStream::Stop() { 526 void VideoSendStream::Stop() {
510 if (!payload_router_.active()) 527 if (!payload_router_.active())
511 return; 528 return;
512 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop"); 529 TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop");
513 // TODO(pbos): Make sure the encoder stops here. 530 // TODO(pbos): Make sure the encoder stops here.
514 payload_router_.set_active(false); 531 payload_router_.set_active(false);
515 } 532 }
516 533
534 VideoCaptureInput* VideoSendStream::Input() {
535 return &input_;
536 }
537
517 bool VideoSendStream::EncoderThreadFunction(void* obj) { 538 bool VideoSendStream::EncoderThreadFunction(void* obj) {
518 static_cast<VideoSendStream*>(obj)->EncoderProcess(); 539 static_cast<VideoSendStream*>(obj)->EncoderProcess();
519 // We're done, return false to abort. 540 // We're done, return false to abort.
520 return false; 541 return false;
521 } 542 }
522 543
523 void VideoSendStream::EncoderProcess() { 544 void VideoSendStream::EncoderProcess() {
524 RTC_CHECK_EQ(0, vie_encoder_.RegisterExternalEncoder( 545 RTC_CHECK_EQ(0, vie_encoder_.RegisterExternalEncoder(
525 config_.encoder_settings.encoder, 546 config_.encoder_settings.encoder,
526 config_.encoder_settings.payload_type, 547 config_.encoder_settings.payload_type,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 config, config_.encoder_settings.payload_name, 594 config, config_.encoder_settings.payload_name,
574 config_.encoder_settings.payload_type); 595 config_.encoder_settings.payload_type);
575 { 596 {
576 rtc::CritScope lock(&encoder_settings_crit_); 597 rtc::CritScope lock(&encoder_settings_crit_);
577 pending_encoder_settings_ = rtc::Optional<EncoderSettings>( 598 pending_encoder_settings_ = rtc::Optional<EncoderSettings>(
578 {video_codec, config.min_transmit_bitrate_bps}); 599 {video_codec, config.min_transmit_bitrate_bps});
579 } 600 }
580 encoder_wakeup_event_.Set(); 601 encoder_wakeup_event_.Set();
581 } 602 }
582 603
583 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
584 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
585 rtp_rtcp->IncomingRtcpPacket(packet, length);
586 return true;
587 }
588
589 VideoSendStream::Stats VideoSendStream::GetStats() { 604 VideoSendStream::Stats VideoSendStream::GetStats() {
590 return stats_proxy_.GetStats(); 605 return stats_proxy_.GetStats();
591 } 606 }
592 607
593 void VideoSendStream::OveruseDetected() { 608 void VideoSendStream::OveruseDetected() {
594 if (config_.overuse_callback) 609 if (config_.overuse_callback)
595 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse); 610 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse);
596 } 611 }
597 612
598 void VideoSendStream::NormalUsage() { 613 void VideoSendStream::NormalUsage() {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 722 }
708 723
709 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) { 724 for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) {
710 uint32_t ssrc = config_.rtp.rtx.ssrcs[i]; 725 uint32_t ssrc = config_.rtp.rtx.ssrcs[i];
711 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState(); 726 rtp_states[ssrc] = rtp_rtcp_modules_[i]->GetRtxState();
712 } 727 }
713 728
714 return rtp_states; 729 return rtp_states;
715 } 730 }
716 731
717 void VideoSendStream::SignalNetworkState(NetworkState state) {
718 // When network goes up, enable RTCP status before setting transmission state.
719 // When it goes down, disable RTCP afterwards. This ensures that any packets
720 // sent due to the network state changed will not be dropped.
721 if (state == kNetworkUp) {
722 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
723 rtp_rtcp->SetRTCPStatus(config_.rtp.rtcp_mode);
724 }
725 vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp);
726 if (state == kNetworkDown) {
727 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
728 rtp_rtcp->SetRTCPStatus(RtcpMode::kOff);
729 }
730 }
731
732 int VideoSendStream::GetPaddingNeededBps() const { 732 int VideoSendStream::GetPaddingNeededBps() const {
733 return vie_encoder_.GetPaddingNeededBps(); 733 return vie_encoder_.GetPaddingNeededBps();
734 } 734 }
735 735
736 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps, 736 void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
737 uint8_t fraction_loss, 737 uint8_t fraction_loss,
738 int64_t rtt) { 738 int64_t rtt) {
739 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt); 739 vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt);
740 } 740 }
741 741
(...skipping 15 matching lines...) Expand all
757 &module_nack_rate); 757 &module_nack_rate);
758 *sent_video_rate_bps += module_video_rate; 758 *sent_video_rate_bps += module_video_rate;
759 *sent_nack_rate_bps += module_nack_rate; 759 *sent_nack_rate_bps += module_nack_rate;
760 *sent_fec_rate_bps += module_fec_rate; 760 *sent_fec_rate_bps += module_fec_rate;
761 } 761 }
762 return 0; 762 return 0;
763 } 763 }
764 764
765 } // namespace internal 765 } // namespace internal
766 } // namespace webrtc 766 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698