OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 uint32_t* sent_nack_rate_bps, | 70 uint32_t* sent_nack_rate_bps, |
71 uint32_t* sent_fec_rate_bps) override { | 71 uint32_t* sent_fec_rate_bps) override { |
72 return owner_->ProtectionRequest(delta_fec_params, key_fec_params, | 72 return owner_->ProtectionRequest(delta_fec_params, key_fec_params, |
73 sent_video_rate_bps, sent_nack_rate_bps, | 73 sent_video_rate_bps, sent_nack_rate_bps, |
74 sent_fec_rate_bps); | 74 sent_fec_rate_bps); |
75 } | 75 } |
76 private: | 76 private: |
77 ViEChannel* owner_; | 77 ViEChannel* owner_; |
78 }; | 78 }; |
79 | 79 |
80 ViEChannel::ViEChannel(uint32_t number_of_cores, | 80 ViEChannel::ViEChannel(Transport* transport, |
81 Transport* transport, | |
82 ProcessThread* module_process_thread, | 81 ProcessThread* module_process_thread, |
83 PayloadRouter* send_payload_router, | 82 PayloadRouter* send_payload_router, |
84 VideoCodingModule* vcm, | 83 VideoCodingModule* vcm, |
85 RtcpIntraFrameObserver* intra_frame_observer, | 84 RtcpIntraFrameObserver* intra_frame_observer, |
86 RtcpBandwidthObserver* bandwidth_observer, | 85 RtcpBandwidthObserver* bandwidth_observer, |
87 TransportFeedbackObserver* transport_feedback_observer, | 86 TransportFeedbackObserver* transport_feedback_observer, |
88 RemoteBitrateEstimator* remote_bitrate_estimator, | 87 RemoteBitrateEstimator* remote_bitrate_estimator, |
89 RtcpRttStats* rtt_stats, | 88 RtcpRttStats* rtt_stats, |
90 PacedSender* paced_sender, | 89 PacedSender* paced_sender, |
91 PacketRouter* packet_router, | 90 PacketRouter* packet_router, |
92 size_t max_rtp_streams, | 91 size_t max_rtp_streams, |
93 bool sender) | 92 bool sender) |
94 : number_of_cores_(number_of_cores), | 93 : sender_(sender), |
95 sender_(sender), | |
96 module_process_thread_(module_process_thread), | 94 module_process_thread_(module_process_thread), |
97 send_payload_router_(send_payload_router), | 95 send_payload_router_(send_payload_router), |
98 vcm_protection_callback_(new ViEChannelProtectionCallback(this)), | 96 vcm_protection_callback_(new ViEChannelProtectionCallback(this)), |
99 vcm_(vcm), | 97 vcm_(vcm), |
100 vie_receiver_(vcm_, remote_bitrate_estimator, this), | 98 vie_receiver_(vcm_, remote_bitrate_estimator, this), |
101 vie_sync_(vcm_), | 99 vie_sync_(vcm_), |
102 stats_observer_(new ChannelStatsObserver(this)), | 100 stats_observer_(new ChannelStatsObserver(this)), |
103 receive_stats_callback_(nullptr), | 101 receive_stats_callback_(nullptr), |
104 incoming_video_stream_(nullptr), | 102 incoming_video_stream_(nullptr), |
105 intra_frame_observer_(intra_frame_observer), | 103 intra_frame_observer_(intra_frame_observer), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); | 406 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i], sender_); |
409 } | 407 } |
410 // Register new active modules. | 408 // Register new active modules. |
411 for (size_t i = num_prev_active_modules; i < num_active_modules; ++i) { | 409 for (size_t i = num_prev_active_modules; i < num_active_modules; ++i) { |
412 module_process_thread_->RegisterModule(rtp_rtcp_modules_[i]); | 410 module_process_thread_->RegisterModule(rtp_rtcp_modules_[i]); |
413 packet_router_->AddRtpModule(rtp_rtcp_modules_[i], sender_); | 411 packet_router_->AddRtpModule(rtp_rtcp_modules_[i], sender_); |
414 } | 412 } |
415 return 0; | 413 return 0; |
416 } | 414 } |
417 | 415 |
418 int32_t ViEChannel::SetReceiveCodec(const VideoCodec& video_codec) { | |
419 RTC_DCHECK(!sender_); | |
420 if (!vie_receiver_.SetReceiveCodec(video_codec)) { | |
421 return -1; | |
422 } | |
423 | |
424 if (video_codec.codecType != kVideoCodecRED && | |
425 video_codec.codecType != kVideoCodecULPFEC) { | |
426 // Register codec type with VCM, but do not register RED or ULPFEC. | |
427 if (vcm_->RegisterReceiveCodec(&video_codec, number_of_cores_, false) != | |
428 VCM_OK) { | |
429 return -1; | |
430 } | |
431 } | |
432 return 0; | |
433 } | |
434 | |
435 void ViEChannel::RegisterExternalDecoder(const uint8_t pl_type, | |
436 VideoDecoder* decoder) { | |
437 RTC_DCHECK(!sender_); | |
438 vcm_->RegisterExternalDecoder(decoder, pl_type); | |
439 } | |
440 | |
441 int32_t ViEChannel::ReceiveCodecStatistics(uint32_t* num_key_frames, | |
442 uint32_t* num_delta_frames) { | |
443 rtc::CritScope lock(&crit_); | |
444 *num_key_frames = receive_frame_counts_.key_frames; | |
445 *num_delta_frames = receive_frame_counts_.delta_frames; | |
446 return 0; | |
447 } | |
448 | |
449 void ViEChannel::SetExpectedRenderDelay(int delay_ms) { | |
450 RTC_DCHECK(!sender_); | |
451 vcm_->SetRenderDelay(delay_ms); | |
452 } | |
453 | |
454 void ViEChannel::SetRTCPMode(const RtcpMode rtcp_mode) { | 416 void ViEChannel::SetRTCPMode(const RtcpMode rtcp_mode) { |
| 417 RTC_DCHECK(sender_); |
455 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 418 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
456 rtp_rtcp->SetRTCPStatus(rtcp_mode); | 419 rtp_rtcp->SetRTCPStatus(rtcp_mode); |
457 } | 420 } |
458 | 421 |
459 void ViEChannel::SetProtectionMode(bool enable_nack, | 422 void ViEChannel::SetProtectionMode(bool enable_nack, |
460 bool enable_fec, | 423 bool enable_fec, |
461 int payload_type_red, | 424 int payload_type_red, |
462 int payload_type_fec) { | 425 int payload_type_fec) { |
463 // Validate payload types. | 426 // Validate payload types. |
464 if (enable_fec) { | 427 if (enable_fec) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 return 0; | 536 return 0; |
574 // Enable the extension. | 537 // Enable the extension. |
575 int error = 0; | 538 int error = 0; |
576 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 539 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
577 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( | 540 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( |
578 kRtpExtensionTransmissionTimeOffset, id); | 541 kRtpExtensionTransmissionTimeOffset, id); |
579 } | 542 } |
580 return error; | 543 return error; |
581 } | 544 } |
582 | 545 |
583 int ViEChannel::SetReceiveTimestampOffsetStatus(bool enable, int id) { | |
584 return vie_receiver_.SetReceiveTimestampOffsetStatus(enable, id) ? 0 : -1; | |
585 } | |
586 | |
587 int ViEChannel::SetSendAbsoluteSendTimeStatus(bool enable, int id) { | 546 int ViEChannel::SetSendAbsoluteSendTimeStatus(bool enable, int id) { |
588 // Disable any previous registrations of this extension to avoid errors. | 547 // Disable any previous registrations of this extension to avoid errors. |
589 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 548 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
590 rtp_rtcp->DeregisterSendRtpHeaderExtension(kRtpExtensionAbsoluteSendTime); | 549 rtp_rtcp->DeregisterSendRtpHeaderExtension(kRtpExtensionAbsoluteSendTime); |
591 if (!enable) | 550 if (!enable) |
592 return 0; | 551 return 0; |
593 // Enable the extension. | 552 // Enable the extension. |
594 int error = 0; | 553 int error = 0; |
595 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 554 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
596 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( | 555 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( |
597 kRtpExtensionAbsoluteSendTime, id); | 556 kRtpExtensionAbsoluteSendTime, id); |
598 } | 557 } |
599 return error; | 558 return error; |
600 } | 559 } |
601 | 560 |
602 int ViEChannel::SetReceiveAbsoluteSendTimeStatus(bool enable, int id) { | |
603 return vie_receiver_.SetReceiveAbsoluteSendTimeStatus(enable, id) ? 0 : -1; | |
604 } | |
605 | |
606 int ViEChannel::SetSendVideoRotationStatus(bool enable, int id) { | 561 int ViEChannel::SetSendVideoRotationStatus(bool enable, int id) { |
607 // Disable any previous registrations of this extension to avoid errors. | 562 // Disable any previous registrations of this extension to avoid errors. |
608 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 563 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
609 rtp_rtcp->DeregisterSendRtpHeaderExtension(kRtpExtensionVideoRotation); | 564 rtp_rtcp->DeregisterSendRtpHeaderExtension(kRtpExtensionVideoRotation); |
610 if (!enable) | 565 if (!enable) |
611 return 0; | 566 return 0; |
612 // Enable the extension. | 567 // Enable the extension. |
613 int error = 0; | 568 int error = 0; |
614 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 569 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
615 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( | 570 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( |
616 kRtpExtensionVideoRotation, id); | 571 kRtpExtensionVideoRotation, id); |
617 } | 572 } |
618 return error; | 573 return error; |
619 } | 574 } |
620 | 575 |
621 int ViEChannel::SetReceiveVideoRotationStatus(bool enable, int id) { | |
622 return vie_receiver_.SetReceiveVideoRotationStatus(enable, id) ? 0 : -1; | |
623 } | |
624 | |
625 int ViEChannel::SetSendTransportSequenceNumber(bool enable, int id) { | 576 int ViEChannel::SetSendTransportSequenceNumber(bool enable, int id) { |
| 577 RTC_DCHECK(sender_); |
626 // Disable any previous registrations of this extension to avoid errors. | 578 // Disable any previous registrations of this extension to avoid errors. |
627 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 579 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
628 rtp_rtcp->DeregisterSendRtpHeaderExtension( | 580 rtp_rtcp->DeregisterSendRtpHeaderExtension( |
629 kRtpExtensionTransportSequenceNumber); | 581 kRtpExtensionTransportSequenceNumber); |
630 } | 582 } |
631 if (!enable) | 583 if (!enable) |
632 return 0; | 584 return 0; |
633 // Enable the extension. | 585 // Enable the extension. |
634 int error = 0; | 586 int error = 0; |
635 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 587 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
636 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( | 588 error |= rtp_rtcp->RegisterSendRtpHeaderExtension( |
637 kRtpExtensionTransportSequenceNumber, id); | 589 kRtpExtensionTransportSequenceNumber, id); |
638 } | 590 } |
639 return error; | 591 return error; |
640 } | 592 } |
641 | 593 |
642 int ViEChannel::SetReceiveTransportSequenceNumber(bool enable, int id) { | |
643 return vie_receiver_.SetReceiveTransportSequenceNumber(enable, id) ? 0 : -1; | |
644 } | |
645 | |
646 void ViEChannel::SetRtcpXrRrtrStatus(bool enable) { | |
647 rtp_rtcp_modules_[0]->SetRtcpXrRrtrStatus(enable); | |
648 } | |
649 | |
650 void ViEChannel::EnableTMMBR(bool enable) { | |
651 rtp_rtcp_modules_[0]->SetTMMBRStatus(enable); | |
652 } | |
653 | |
654 int32_t ViEChannel::SetSSRC(const uint32_t SSRC, | 594 int32_t ViEChannel::SetSSRC(const uint32_t SSRC, |
655 const StreamType usage, | 595 const StreamType usage, |
656 const uint8_t simulcast_idx) { | 596 const uint8_t simulcast_idx) { |
| 597 RTC_DCHECK(sender_); |
657 RtpRtcp* rtp_rtcp = rtp_rtcp_modules_[simulcast_idx]; | 598 RtpRtcp* rtp_rtcp = rtp_rtcp_modules_[simulcast_idx]; |
658 if (usage == kViEStreamTypeRtx) { | 599 if (usage == kViEStreamTypeRtx) { |
659 rtp_rtcp->SetRtxSsrc(SSRC); | 600 rtp_rtcp->SetRtxSsrc(SSRC); |
660 } else { | 601 } else { |
661 rtp_rtcp->SetSSRC(SSRC); | 602 rtp_rtcp->SetSSRC(SSRC); |
662 } | 603 } |
663 return 0; | 604 return 0; |
664 } | 605 } |
665 | 606 |
666 int32_t ViEChannel::SetRemoteSSRCType(const StreamType usage, | |
667 const uint32_t SSRC) { | |
668 vie_receiver_.SetRtxSsrc(SSRC); | |
669 return 0; | |
670 } | |
671 | |
672 int32_t ViEChannel::GetLocalSSRC(uint8_t idx, unsigned int* ssrc) { | 607 int32_t ViEChannel::GetLocalSSRC(uint8_t idx, unsigned int* ssrc) { |
673 RTC_DCHECK_LE(idx, rtp_rtcp_modules_.size()); | 608 RTC_DCHECK_LE(idx, rtp_rtcp_modules_.size()); |
674 *ssrc = rtp_rtcp_modules_[idx]->SSRC(); | 609 *ssrc = rtp_rtcp_modules_[idx]->SSRC(); |
675 return 0; | 610 return 0; |
676 } | 611 } |
677 | 612 |
678 uint32_t ViEChannel::GetRemoteSSRC() { | 613 uint32_t ViEChannel::GetRemoteSSRC() { |
| 614 RTC_DCHECK(sender_); |
679 return vie_receiver_.GetRemoteSsrc(); | 615 return vie_receiver_.GetRemoteSsrc(); |
680 } | 616 } |
681 | 617 |
682 int ViEChannel::SetRtxSendPayloadType(int payload_type, | 618 int ViEChannel::SetRtxSendPayloadType(int payload_type, |
683 int associated_payload_type) { | 619 int associated_payload_type) { |
684 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 620 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
685 rtp_rtcp->SetRtxSendPayloadType(payload_type, associated_payload_type); | 621 rtp_rtcp->SetRtxSendPayloadType(payload_type, associated_payload_type); |
686 SetRtxSendStatus(true); | 622 SetRtxSendStatus(true); |
687 return 0; | 623 return 0; |
688 } | 624 } |
689 | 625 |
690 void ViEChannel::SetRtxSendStatus(bool enable) { | 626 void ViEChannel::SetRtxSendStatus(bool enable) { |
691 int rtx_settings = | 627 int rtx_settings = |
692 enable ? kRtxRetransmitted | kRtxRedundantPayloads : kRtxOff; | 628 enable ? kRtxRetransmitted | kRtxRedundantPayloads : kRtxOff; |
693 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 629 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
694 rtp_rtcp->SetRtxSendStatus(rtx_settings); | 630 rtp_rtcp->SetRtxSendStatus(rtx_settings); |
695 } | 631 } |
696 | 632 |
697 void ViEChannel::SetRtxReceivePayloadType(int payload_type, | |
698 int associated_payload_type) { | |
699 vie_receiver_.SetRtxPayloadType(payload_type, associated_payload_type); | |
700 } | |
701 | |
702 void ViEChannel::SetUseRtxPayloadMappingOnRestore(bool val) { | |
703 vie_receiver_.SetUseRtxPayloadMappingOnRestore(val); | |
704 } | |
705 | |
706 void ViEChannel::SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) { | 633 void ViEChannel::SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) { |
707 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending()); | 634 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending()); |
708 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 635 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
709 if (rtp_rtcp->SetRtpStateForSsrc(ssrc, rtp_state)) | 636 if (rtp_rtcp->SetRtpStateForSsrc(ssrc, rtp_state)) |
710 return; | 637 return; |
711 } | 638 } |
712 } | 639 } |
713 | 640 |
714 RtpState ViEChannel::GetRtpStateForSsrc(uint32_t ssrc) { | 641 RtpState ViEChannel::GetRtpStateForSsrc(uint32_t ssrc) { |
715 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending()); | 642 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 *rtt_ms = rtt; | 706 *rtt_ms = rtt; |
780 return 0; | 707 return 0; |
781 } | 708 } |
782 | 709 |
783 void ViEChannel::RegisterSendChannelRtcpStatisticsCallback( | 710 void ViEChannel::RegisterSendChannelRtcpStatisticsCallback( |
784 RtcpStatisticsCallback* callback) { | 711 RtcpStatisticsCallback* callback) { |
785 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 712 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
786 rtp_rtcp->RegisterRtcpStatisticsCallback(callback); | 713 rtp_rtcp->RegisterRtcpStatisticsCallback(callback); |
787 } | 714 } |
788 | 715 |
789 void ViEChannel::RegisterReceiveChannelRtcpStatisticsCallback( | |
790 RtcpStatisticsCallback* callback) { | |
791 vie_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback( | |
792 callback); | |
793 rtp_rtcp_modules_[0]->RegisterRtcpStatisticsCallback(callback); | |
794 } | |
795 | |
796 void ViEChannel::RegisterRtcpPacketTypeCounterObserver( | 716 void ViEChannel::RegisterRtcpPacketTypeCounterObserver( |
797 RtcpPacketTypeCounterObserver* observer) { | 717 RtcpPacketTypeCounterObserver* observer) { |
798 rtcp_packet_type_counter_observer_.Set(observer); | 718 rtcp_packet_type_counter_observer_.Set(observer); |
799 } | 719 } |
800 | 720 |
801 void ViEChannel::GetSendStreamDataCounters( | 721 void ViEChannel::GetSendStreamDataCounters( |
802 StreamDataCounters* rtp_counters, | 722 StreamDataCounters* rtp_counters, |
803 StreamDataCounters* rtx_counters) const { | 723 StreamDataCounters* rtx_counters) const { |
804 *rtp_counters = StreamDataCounters(); | 724 *rtp_counters = StreamDataCounters(); |
805 *rtx_counters = StreamDataCounters(); | 725 *rtx_counters = StreamDataCounters(); |
(...skipping 23 matching lines...) Expand all Loading... |
829 } | 749 } |
830 } | 750 } |
831 } | 751 } |
832 | 752 |
833 void ViEChannel::RegisterSendChannelRtpStatisticsCallback( | 753 void ViEChannel::RegisterSendChannelRtpStatisticsCallback( |
834 StreamDataCountersCallback* callback) { | 754 StreamDataCountersCallback* callback) { |
835 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 755 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
836 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(callback); | 756 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(callback); |
837 } | 757 } |
838 | 758 |
839 void ViEChannel::RegisterReceiveChannelRtpStatisticsCallback( | |
840 StreamDataCountersCallback* callback) { | |
841 vie_receiver_.GetReceiveStatistics()->RegisterRtpStatisticsCallback(callback); | |
842 } | |
843 | |
844 void ViEChannel::GetSendRtcpPacketTypeCounter( | 759 void ViEChannel::GetSendRtcpPacketTypeCounter( |
845 RtcpPacketTypeCounter* packet_counter) const { | 760 RtcpPacketTypeCounter* packet_counter) const { |
846 std::map<uint32_t, RtcpPacketTypeCounter> counter_map = | 761 std::map<uint32_t, RtcpPacketTypeCounter> counter_map = |
847 rtcp_packet_type_counter_observer_.GetPacketTypeCounterMap(); | 762 rtcp_packet_type_counter_observer_.GetPacketTypeCounterMap(); |
848 | 763 |
849 RtcpPacketTypeCounter counter; | 764 RtcpPacketTypeCounter counter; |
850 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 765 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
851 counter.Add(counter_map[rtp_rtcp->SSRC()]); | 766 counter.Add(counter_map[rtp_rtcp->SSRC()]); |
852 *packet_counter = counter; | 767 *packet_counter = counter; |
853 } | 768 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 StartDecodeThread(); | 830 StartDecodeThread(); |
916 vie_receiver_.StartReceive(); | 831 vie_receiver_.StartReceive(); |
917 } | 832 } |
918 | 833 |
919 void ViEChannel::StopReceive() { | 834 void ViEChannel::StopReceive() { |
920 vie_receiver_.StopReceive(); | 835 vie_receiver_.StopReceive(); |
921 if (!sender_) | 836 if (!sender_) |
922 StopDecodeThread(); | 837 StopDecodeThread(); |
923 } | 838 } |
924 | 839 |
925 int32_t ViEChannel::ReceivedRTPPacket(const void* rtp_packet, | |
926 size_t rtp_packet_length, | |
927 const PacketTime& packet_time) { | |
928 return vie_receiver_.ReceivedRTPPacket( | |
929 rtp_packet, rtp_packet_length, packet_time); | |
930 } | |
931 | |
932 int32_t ViEChannel::ReceivedRTCPPacket(const void* rtcp_packet, | 840 int32_t ViEChannel::ReceivedRTCPPacket(const void* rtcp_packet, |
933 size_t rtcp_packet_length) { | 841 size_t rtcp_packet_length) { |
934 return vie_receiver_.ReceivedRTCPPacket(rtcp_packet, rtcp_packet_length); | 842 RTC_DCHECK(sender_); |
| 843 return vie_receiver_.DeliverRtcp( |
| 844 reinterpret_cast<const uint8_t*>(rtcp_packet), rtcp_packet_length) |
| 845 ? 0 |
| 846 : -1; |
935 } | 847 } |
936 | 848 |
937 int32_t ViEChannel::SetMTU(uint16_t mtu) { | 849 int32_t ViEChannel::SetMTU(uint16_t mtu) { |
| 850 RTC_DCHECK(sender_); |
938 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 851 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
939 rtp_rtcp->SetMaxTransferUnit(mtu); | 852 rtp_rtcp->SetMaxTransferUnit(mtu); |
940 return 0; | 853 return 0; |
941 } | 854 } |
942 | 855 |
943 RtpRtcp* ViEChannel::rtp_rtcp() { | 856 RtpRtcp* ViEChannel::rtp_rtcp() { |
944 return rtp_rtcp_modules_[0]; | 857 return rtp_rtcp_modules_[0]; |
945 } | 858 } |
946 | 859 |
| 860 ViEReceiver* ViEChannel::vie_receiver() { |
| 861 return &vie_receiver_; |
| 862 } |
| 863 |
947 VCMProtectionCallback* ViEChannel::vcm_protection_callback() { | 864 VCMProtectionCallback* ViEChannel::vcm_protection_callback() { |
948 return vcm_protection_callback_.get(); | 865 return vcm_protection_callback_.get(); |
949 } | 866 } |
950 | 867 |
951 CallStatsObserver* ViEChannel::GetStatsObserver() { | 868 CallStatsObserver* ViEChannel::GetStatsObserver() { |
952 return stats_observer_.get(); | 869 return stats_observer_.get(); |
953 } | 870 } |
954 | 871 |
955 // Do not acquire the lock of |vcm_| in this function. Decode callback won't | 872 // Do not acquire the lock of |vcm_| in this function. Decode callback won't |
956 // necessarily be called from the decoding thread. The decoding thread may have | 873 // necessarily be called from the decoding thread. The decoding thread may have |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 vie_receiver_.GetRtpReceiver()); | 1070 vie_receiver_.GetRtpReceiver()); |
1154 } | 1071 } |
1155 | 1072 |
1156 int32_t ViEChannel::VoiceChannel() { | 1073 int32_t ViEChannel::VoiceChannel() { |
1157 RTC_DCHECK(!sender_); | 1074 RTC_DCHECK(!sender_); |
1158 return vie_sync_.VoiceChannel(); | 1075 return vie_sync_.VoiceChannel(); |
1159 } | 1076 } |
1160 | 1077 |
1161 void ViEChannel::RegisterPreRenderCallback( | 1078 void ViEChannel::RegisterPreRenderCallback( |
1162 I420FrameCallback* pre_render_callback) { | 1079 I420FrameCallback* pre_render_callback) { |
| 1080 RTC_DCHECK(!sender_); |
1163 rtc::CritScope lock(&crit_); | 1081 rtc::CritScope lock(&crit_); |
1164 pre_render_callback_ = pre_render_callback; | 1082 pre_render_callback_ = pre_render_callback; |
1165 } | 1083 } |
1166 | 1084 |
1167 void ViEChannel::RegisterPreDecodeImageCallback( | |
1168 EncodedImageCallback* pre_decode_callback) { | |
1169 RTC_DCHECK(!sender_); | |
1170 vcm_->RegisterPreDecodeImageCallback(pre_decode_callback); | |
1171 } | |
1172 | |
1173 // TODO(pbos): Remove as soon as audio can handle a changing payload type | 1085 // TODO(pbos): Remove as soon as audio can handle a changing payload type |
1174 // without this callback. | 1086 // without this callback. |
1175 int32_t ViEChannel::OnInitializeDecoder( | 1087 int32_t ViEChannel::OnInitializeDecoder( |
1176 const int8_t payload_type, | 1088 const int8_t payload_type, |
1177 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 1089 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
1178 const int frequency, | 1090 const int frequency, |
1179 const size_t channels, | 1091 const size_t channels, |
1180 const uint32_t rate) { | 1092 const uint32_t rate) { |
1181 RTC_NOTREACHED(); | 1093 RTC_NOTREACHED(); |
1182 return 0; | 1094 return 0; |
(...skipping 15 matching lines...) Expand all Loading... |
1198 rtc::CritScope lock(&crit_); | 1110 rtc::CritScope lock(&crit_); |
1199 receive_stats_callback_ = receive_statistics_proxy; | 1111 receive_stats_callback_ = receive_statistics_proxy; |
1200 } | 1112 } |
1201 | 1113 |
1202 void ViEChannel::SetIncomingVideoStream( | 1114 void ViEChannel::SetIncomingVideoStream( |
1203 IncomingVideoStream* incoming_video_stream) { | 1115 IncomingVideoStream* incoming_video_stream) { |
1204 rtc::CritScope lock(&crit_); | 1116 rtc::CritScope lock(&crit_); |
1205 incoming_video_stream_ = incoming_video_stream; | 1117 incoming_video_stream_ = incoming_video_stream; |
1206 } | 1118 } |
1207 } // namespace webrtc | 1119 } // namespace webrtc |
OLD | NEW |