diff options
author | pbos@webrtc.org <pbos@webrtc.org> | 2014-11-14 11:52:04 +0000 |
---|---|---|
committer | pbos@webrtc.org <pbos@webrtc.org> | 2014-11-14 11:52:04 +0000 |
commit | ece3890d3a40fe911ae895e28c329491e795b14d (patch) | |
tree | 4cff912ea0f1695ba2aa658d5ec87e129cbac5d2 /webrtc | |
parent | 35c1ace18532b50ff274f65b1369889baefca319 (diff) | |
download | webrtc-ece3890d3a40fe911ae895e28c329491e795b14d.tar.gz |
Report total bitrate for all streams in GetStats.
This regression wasn't caught because I accidentally disabled multiple
streams for EndToEndTest.GetStats in a refactoring.
R=stefan@webrtc.org, xians@webrtc.org
BUG=1667
Review URL: https://webrtc-codereview.appspot.com/27179004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7701 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'webrtc')
22 files changed, 22 insertions, 465 deletions
diff --git a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h index e117b234fd..ca686c08ee 100644 --- a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h @@ -42,8 +42,6 @@ class RtpRtcp : public Module { * will do nothing. * outgoing_transport - Transport object that will be called when packets * are ready to be sent out on the network - * rtcp_feedback - Callback object that will receive the incoming - * RTCP messages. * intra_frame_callback - Called when the receiver request a intra frame. * bandwidth_callback - Called when we receive a changed estimate from * the receiver of out stream. @@ -60,7 +58,6 @@ class RtpRtcp : public Module { RtpRtcp* default_module; ReceiveStatistics* receive_statistics; Transport* outgoing_transport; - RtcpFeedback* rtcp_feedback; RtcpIntraFrameObserver* intra_frame_callback; RtcpBandwidthObserver* bandwidth_callback; RtcpRttStats* rtt_stats; diff --git a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h index 2d6b272af8..dc51467ee1 100644 --- a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h +++ b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h @@ -227,26 +227,6 @@ public: int packet_length) = 0; }; -class RtcpFeedback -{ -public: - virtual void OnApplicationDataReceived(const int32_t /*id*/, - const uint8_t /*subType*/, - const uint32_t /*name*/, - const uint16_t /*length*/, - const uint8_t* /*data*/) {}; - - virtual void OnXRVoIPMetricReceived( - const int32_t /*id*/, - const RTCPVoIPMetric* /*metric*/) {}; - - virtual void OnReceiveReportReceived(const int32_t id, - const uint32_t senderSSRC) {}; - -protected: - virtual ~RtcpFeedback() {} -}; - class RtpFeedback { public: diff --git a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index 7e187c75a5..584b9ad6b2 100644 --- a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -136,10 +136,9 @@ class MockRtpRtcp : public RtpRtcp { int(int bytes)); MOCK_CONST_METHOD2(GetSendSideDelay, bool(int* avg_send_delay_ms, int* max_send_delay_ms)); - MOCK_METHOD3(RegisterRtcpObservers, + MOCK_METHOD2(RegisterRtcpObservers, void(RtcpIntraFrameObserver* intraFrameCallback, - RtcpBandwidthObserver* bandwidthCallback, - RtcpFeedback* callback)); + RtcpBandwidthObserver* bandwidthCallback)); MOCK_CONST_METHOD0(RTCP, RTCPMethod()); MOCK_METHOD1(SetRTCPStatus, diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index 1d1e29167f..8d044801fc 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -38,7 +38,6 @@ RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock, _rtpRtcp(*owner), _criticalSectionFeedbacks( CriticalSectionWrapper::CreateCriticalSection()), - _cbRtcpFeedback(NULL), _cbRtcpBandwidthObserver(NULL), _cbRtcpIntraFrameObserver(NULL), _criticalSectionRTCPReceiver( @@ -145,12 +144,10 @@ uint32_t RTCPReceiver::RemoteSSRC() const { void RTCPReceiver::RegisterRtcpObservers( RtcpIntraFrameObserver* intra_frame_callback, - RtcpBandwidthObserver* bandwidth_callback, - RtcpFeedback* feedback_callback) { + RtcpBandwidthObserver* bandwidth_callback) { CriticalSectionScoped lock(_criticalSectionFeedbacks); _cbRtcpIntraFrameObserver = intra_frame_callback; _cbRtcpBandwidthObserver = bandwidth_callback; - _cbRtcpFeedback = feedback_callback; } void RTCPReceiver::SetSsrcs(uint32_t main_ssrc, @@ -1442,23 +1439,6 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket( now); } } - if(_cbRtcpFeedback) { - if(!(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr)) { - _cbRtcpFeedback->OnReceiveReportReceived(_id, - rtcpPacketInformation.remoteSSRC); - } - if(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpXrVoipMetric) { - _cbRtcpFeedback->OnXRVoIPMetricReceived(_id, - rtcpPacketInformation.VoIPMetric); - } - if(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpApp) { - _cbRtcpFeedback->OnApplicationDataReceived(_id, - rtcpPacketInformation.applicationSubType, - rtcpPacketInformation.applicationName, - rtcpPacketInformation.applicationLength, - rtcpPacketInformation.applicationData); - } - } } { diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h index 087722c42f..ecc5ebed73 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h @@ -49,8 +49,7 @@ public: uint32_t RelaySSRC() const; void RegisterRtcpObservers(RtcpIntraFrameObserver* intra_frame_callback, - RtcpBandwidthObserver* bandwidth_callback, - RtcpFeedback* feedback_callback); + RtcpBandwidthObserver* bandwidth_callback); int32_t IncomingRTCPPacket( RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, @@ -228,7 +227,6 @@ protected: ModuleRtpRtcpImpl& _rtpRtcp; CriticalSectionWrapper* _criticalSectionFeedbacks; - RtcpFeedback* _cbRtcpFeedback; RtcpBandwidthObserver* _cbRtcpBandwidthObserver; RtcpIntraFrameObserver* _cbRtcpIntraFrameObserver; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index f8713e2755..6446cb7c49 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -31,7 +31,6 @@ RtpRtcp::Configuration::Configuration() default_module(NULL), receive_statistics(NullObjectReceiveStatistics()), outgoing_transport(NULL), - rtcp_feedback(NULL), intra_frame_callback(NULL), bandwidth_callback(NULL), rtt_stats(NULL), @@ -102,8 +101,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) } // TODO(pwestin) move to constructors of each rtp/rtcp sender/receiver object. rtcp_receiver_.RegisterRtcpObservers(configuration.intra_frame_callback, - configuration.bandwidth_callback, - configuration.rtcp_feedback); + configuration.bandwidth_callback); rtcp_sender_.RegisterSendTransport(configuration.outgoing_transport); // Make sure that RTCP objects are aware of our SSRC. diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc index 9d0505ef71..8cbdeb5b91 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc @@ -24,7 +24,7 @@ using namespace webrtc; const uint64_t kTestPictureId = 12345678; -class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver { +class RtcpCallback : public RtcpIntraFrameObserver { public: void SetModule(RtpRtcp* module) { _rtpRtcpModule = module; @@ -34,27 +34,6 @@ class RtcpCallback : public RtcpFeedback, public RtcpIntraFrameObserver { virtual void OnLipSyncUpdate(const int32_t id, const int32_t audioVideoOffset) { }; - virtual void OnXRVoIPMetricReceived( - const int32_t id, - const RTCPVoIPMetric* metric) { - }; - virtual void OnApplicationDataReceived(const int32_t id, - const uint8_t subType, - const uint32_t name, - const uint16_t length, - const uint8_t* data) { - char print_name[5]; - print_name[0] = static_cast<char>(name >> 24); - print_name[1] = static_cast<char>(name >> 16); - print_name[2] = static_cast<char>(name >> 8); - print_name[3] = static_cast<char>(name); - print_name[4] = 0; - - EXPECT_STRCASEEQ("test", print_name); - }; - virtual void OnReceiveReportReceived(const int32_t id, - const uint32_t senderSSRC) { - }; virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) { }; virtual void OnReceivedSLI(uint32_t ssrc, @@ -112,7 +91,6 @@ class RtpRtcpRtcpTest : public ::testing::Test { configuration.clock = &fake_clock; configuration.receive_statistics = receive_statistics1_.get(); configuration.outgoing_transport = transport1; - configuration.rtcp_feedback = myRTCPFeedback1; configuration.intra_frame_callback = myRTCPFeedback1; rtp_payload_registry1_.reset(new RTPPayloadRegistry( @@ -131,7 +109,6 @@ class RtpRtcpRtcpTest : public ::testing::Test { configuration.receive_statistics = receive_statistics2_.get(); configuration.id = test_id + 1; configuration.outgoing_transport = transport2; - configuration.rtcp_feedback = myRTCPFeedback2; configuration.intra_frame_callback = myRTCPFeedback2; module2 = RtpRtcp::CreateRtpRtcp(configuration); diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc index b7ad380b2f..75cc26d860 100644 --- a/webrtc/video/end_to_end_tests.cc +++ b/webrtc/video/end_to_end_tests.cc @@ -1578,6 +1578,8 @@ TEST_F(EndToEndTest, GetStats) { expected_cname_ = send_config->rtp.c_name; } + virtual size_t GetNumStreams() const OVERRIDE { return kNumSsrcs; } + virtual void OnStreamsCreated( VideoSendStream* send_stream, const std::vector<VideoReceiveStream*>& receive_streams) OVERRIDE { diff --git a/webrtc/video_engine/include/vie_rtp_rtcp.h b/webrtc/video_engine/include/vie_rtp_rtcp.h index 8771ea8e77..fdf96bbc4c 100644 --- a/webrtc/video_engine/include/vie_rtp_rtcp.h +++ b/webrtc/video_engine/include/vie_rtp_rtcp.h @@ -69,25 +69,6 @@ class WEBRTC_DLLEXPORT ViERTPObserver { virtual ~ViERTPObserver() {} }; -// This class declares an abstract interface for a user defined observer. It is -// up to the VideoEngine user to implement a derived class which implements the -// observer class. The observer is registered using RegisterRTCPObserver() and -// deregistered using DeregisterRTCPObserver(). - -class WEBRTC_DLLEXPORT ViERTCPObserver { - public: - // This method is called if a application-defined RTCP packet has been - // received. - virtual void OnApplicationDataReceived( - const int video_channel, - const unsigned char sub_type, - const unsigned int name, - const char* data, - const unsigned short data_length_in_bytes) = 0; - protected: - virtual ~ViERTCPObserver() {} -}; - class WEBRTC_DLLEXPORT ViERTP_RTCP { public: enum { KDefaultDeltaTransmitTimeSeconds = 15 }; @@ -468,13 +449,6 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP { // Removes a registered instance of ViERTPObserver. virtual int DeregisterRTPObserver(const int video_channel) = 0; - // Registers an instance of a user implementation of the ViERTCPObserver. - virtual int RegisterRTCPObserver(const int video_channel, - ViERTCPObserver& observer) = 0; - - // Removes a registered instance of ViERTCPObserver. - virtual int DeregisterRTCPObserver(const int video_channel) = 0; - // Registers and instance of a user implementation of ViEFrameCountObserver virtual int RegisterSendFrameCountObserver( int video_channel, FrameCountObserver* observer) = 0; diff --git a/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc b/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc index e43fc751b0..4508d8e791 100644 --- a/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc +++ b/webrtc/video_engine/test/auto_test/automated/vie_extended_integration_test.cc @@ -52,9 +52,4 @@ TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), tests_->ViERenderExtendedTest(); } -TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest), - DISABLED_RunsRtpRtcpTestWithoutErrors) { - tests_->ViERtpRtcpExtendedTest(); -} - } // namespace diff --git a/webrtc/video_engine/test/auto_test/interface/vie_autotest.h b/webrtc/video_engine/test/auto_test/interface/vie_autotest.h index 7a83637860..c584988adf 100644 --- a/webrtc/video_engine/test/auto_test/interface/vie_autotest.h +++ b/webrtc/video_engine/test/auto_test/interface/vie_autotest.h @@ -100,7 +100,6 @@ public: // vie_autotest_rtp_rtcp.cc void ViERtpRtcpStandardTest(); - void ViERtpRtcpExtendedTest(); void ViERtpRtcpAPITest(); private: diff --git a/webrtc/video_engine/test/auto_test/source/vie_autotest.cc b/webrtc/video_engine/test/auto_test/source/vie_autotest.cc index 41fafaef08..aa9dbd54ce 100644 --- a/webrtc/video_engine/test/auto_test/source/vie_autotest.cc +++ b/webrtc/video_engine/test/auto_test/source/vie_autotest.cc @@ -76,7 +76,6 @@ void ViEAutoTest::ViEExtendedTest() ViECodecExtendedTest(); ViEImageProcessExtendedTest(); ViERenderExtendedTest(); - ViERtpRtcpExtendedTest(); } void ViEAutoTest::ViEAPITest() diff --git a/webrtc/video_engine/test/auto_test/source/vie_autotest_android.cc b/webrtc/video_engine/test/auto_test/source/vie_autotest_android.cc index ced235f6b5..ab68634927 100644 --- a/webrtc/video_engine/test/auto_test/source/vie_autotest_android.cc +++ b/webrtc/video_engine/test/auto_test/source/vie_autotest_android.cc @@ -150,7 +150,8 @@ int ViEAutoTestAndroid::RunAutotest(int testSelection, int subTestSelection, break; case 8: // RTP/RTCP - vieAutoTest.ViERtpRtcpExtendedTest(); + // Note that this test is removed. It hasn't been properly cleaned up + // because this hopefully going away soon. break; default: diff --git a/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc b/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc index b7d02156c2..923fe41b1b 100644 --- a/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc +++ b/webrtc/video_engine/test/auto_test/source/vie_autotest_rtp_rtcp.cc @@ -40,52 +40,6 @@ public: } }; -class ViERtcpObserver: public webrtc::ViERTCPObserver -{ -public: - int _channel; - unsigned char _subType; - unsigned int _name; - char* _data; - unsigned short _dataLength; - - ViERtcpObserver() : - _channel(-1), - _subType(0), - _name(0), - _data(NULL), - _dataLength(0) - { - } - ~ViERtcpObserver() - { - if (_data) - { - delete[] _data; - } - } - virtual void OnApplicationDataReceived( - const int videoChannel, const unsigned char subType, - const unsigned int name, const char* data, - const unsigned short dataLengthInBytes) - { - _channel = videoChannel; - _subType = subType; - _name = name; - if (dataLengthInBytes > _dataLength) - { - delete[] _data; - _data = NULL; - } - if (_data == NULL) - { - _data = new char[dataLengthInBytes]; - } - memcpy(_data, data, dataLengthInBytes); - _dataLength = dataLengthInBytes; - } -}; - void ViEAutoTest::ViERtpRtcpStandardTest() { // *************************************************************** @@ -630,70 +584,6 @@ void ViEAutoTest::ViERtpRtcpStandardTest() //*************************************************************** } -void ViEAutoTest::ViERtpRtcpExtendedTest() -{ - //*************************************************************** - // Begin create/initialize WebRTC Video Engine for testing - //*************************************************************** - // Create VIE - TbInterfaces ViE("ViERtpRtcpExtendedTest"); - // Create a video channel - TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8); - // Create a capture device - TbCaptureDevice tbCapture(ViE); - tbCapture.ConnectTo(tbChannel.videoChannel); - - //tbChannel.StartReceive(rtpPort); - //tbChannel.StartSend(rtpPort); - TbExternalTransport myTransport(*(ViE.network), tbChannel.videoChannel, - NULL); - - EXPECT_EQ(0, ViE.network->DeregisterSendTransport(tbChannel.videoChannel)); - EXPECT_EQ(0, ViE.network->RegisterSendTransport( - tbChannel.videoChannel, myTransport)); - EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel)); - EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel)); - - //*************************************************************** - // Engine ready. Begin testing class - //*************************************************************** - - // - // Application specific RTCP - // - // - - ViERtcpObserver rtcpObserver; - EXPECT_EQ(0, ViE.rtp_rtcp->RegisterRTCPObserver( - tbChannel.videoChannel, rtcpObserver)); - - unsigned char subType = 3; - unsigned int name = static_cast<unsigned int> (0x41424344); // 'ABCD'; - const char* data = "ViEAutoTest Data of length 32 -\0"; - const unsigned short numBytes = 32; - - EXPECT_EQ(0, ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket( - tbChannel.videoChannel, subType, name, data, numBytes)); - - ViETest::Log("Sending RTCP application data...\n"); - AutoTestSleep(kAutoTestSleepTimeMs); - - EXPECT_EQ(subType, rtcpObserver._subType); - EXPECT_STRCASEEQ(data, rtcpObserver._data); - EXPECT_EQ(name, rtcpObserver._name); - EXPECT_EQ(numBytes, rtcpObserver._dataLength); - - ViETest::Log("\t RTCP application data received\n"); - - //*************************************************************** - // Testing finished. Tear down Video Engine - //*************************************************************** - EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel)); - EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel)); - - EXPECT_EQ(0, ViE.network->DeregisterSendTransport(tbChannel.videoChannel)); -} - void ViEAutoTest::ViERtpRtcpAPITest() { //*************************************************************** @@ -853,16 +743,6 @@ void ViEAutoTest::ViERtpRtcpAPITest() tbChannel.videoChannel)); EXPECT_NE(0, ViE.rtp_rtcp->DeregisterRTPObserver( tbChannel.videoChannel)); - - ViERtcpObserver rtcpObserver; - EXPECT_EQ(0, ViE.rtp_rtcp->RegisterRTCPObserver( - tbChannel.videoChannel, rtcpObserver)); - EXPECT_NE(0, ViE.rtp_rtcp->RegisterRTCPObserver( - tbChannel.videoChannel, rtcpObserver)); - EXPECT_EQ(0, ViE.rtp_rtcp->DeregisterRTCPObserver( - tbChannel.videoChannel)); - EXPECT_NE(0, ViE.rtp_rtcp->DeregisterRTCPObserver( - tbChannel.videoChannel)); } // // PLI diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index ded21407c9..270da2a252 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -130,7 +130,6 @@ ViEChannel::ViEChannel(int32_t channel_id, codec_observer_(NULL), do_key_frame_callbackRequest_(false), rtp_observer_(NULL), - rtcp_observer_(NULL), intra_frame_observer_(intra_frame_observer), rtt_stats_(rtt_stats), paced_sender_(paced_sender), @@ -150,22 +149,9 @@ ViEChannel::ViEChannel(int32_t channel_id, max_nack_reordering_threshold_(kMaxPacketAgeToNack), pre_render_callback_(NULL), start_ms_(Clock::GetRealTimeClock()->TimeInMilliseconds()) { - RtpRtcp::Configuration configuration; - configuration.id = ViEModuleId(engine_id, channel_id); - configuration.audio = false; - configuration.default_module = default_rtp_rtcp; - configuration.outgoing_transport = &vie_sender_; - configuration.rtcp_feedback = this; - configuration.intra_frame_callback = intra_frame_observer; - configuration.bandwidth_callback = bandwidth_observer; - configuration.rtt_stats = rtt_stats; + RtpRtcp::Configuration configuration = CreateRtpRtcpConfiguration(); configuration.remote_bitrate_estimator = remote_bitrate_estimator; - configuration.paced_sender = paced_sender; configuration.receive_statistics = vie_receiver_.GetReceiveStatistics(); - configuration.send_bitrate_observer = &send_bitrate_observer_; - configuration.send_frame_count_observer = &send_frame_count_observer_; - configuration.send_side_delay_observer = &send_side_delay_observer_; - rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(configuration)); vie_receiver_.SetRtpRtcpModule(rtp_rtcp_.get()); vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0); @@ -1013,20 +999,6 @@ int32_t ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) { return 0; } -int32_t ViEChannel::RegisterRtcpObserver(ViERTCPObserver* observer) { - CriticalSectionScoped cs(callback_cs_.get()); - if (observer) { - if (rtcp_observer_) { - LOG_F(LS_ERROR) << "Observer already registered."; - return -1; - } - rtcp_observer_ = observer; - } else { - rtcp_observer_ = NULL; - } - return 0; -} - int32_t ViEChannel::SendApplicationDefinedRTCPPacket( const uint8_t sub_type, uint32_t name, @@ -1640,19 +1612,25 @@ RtpRtcp* ViEChannel::GetRtpRtcpModule(size_t index) const { return *it; } -RtpRtcp* ViEChannel::CreateRtpRtcpModule() { +RtpRtcp::Configuration ViEChannel::CreateRtpRtcpConfiguration() { RtpRtcp::Configuration configuration; configuration.id = ViEModuleId(engine_id_, channel_id_); - configuration.audio = false; // Video. + configuration.audio = false; configuration.default_module = default_rtp_rtcp_; configuration.outgoing_transport = &vie_sender_; configuration.intra_frame_callback = intra_frame_observer_; configuration.bandwidth_callback = bandwidth_observer_.get(); configuration.rtt_stats = rtt_stats_; configuration.paced_sender = paced_sender_; + configuration.send_bitrate_observer = &send_bitrate_observer_; + configuration.send_frame_count_observer = &send_frame_count_observer_; configuration.send_side_delay_observer = &send_side_delay_observer_; - return RtpRtcp::CreateRtpRtcp(configuration); + return configuration; +} + +RtpRtcp* ViEChannel::CreateRtpRtcpModule() { + return RtpRtcp::CreateRtpRtcp(CreateRtpRtcpConfiguration()); } int32_t ViEChannel::StartDecodeThread() { @@ -1732,24 +1710,6 @@ void ViEChannel::RegisterPreDecodeImageCallback( vcm_->RegisterPreDecodeImageCallback(pre_decode_callback); } -void ViEChannel::OnApplicationDataReceived(const int32_t id, - const uint8_t sub_type, - const uint32_t name, - const uint16_t length, - const uint8_t* data) { - if (channel_id_ != ChannelId(id)) { - return; - } - CriticalSectionScoped cs(callback_cs_.get()); - { - if (rtcp_observer_) { - rtcp_observer_->OnApplicationDataReceived( - channel_id_, sub_type, name, reinterpret_cast<const char*>(data), - length); - } - } -} - int32_t ViEChannel::OnInitializeDecoder( const int32_t id, const int8_t payload_type, diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index 3b8d96a283..97b158784b 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -14,6 +14,7 @@ #include <list> #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" +#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" @@ -39,11 +40,9 @@ class I420FrameCallback; class PacedSender; class ProcessThread; class RtcpRttStats; -class RtpRtcp; class ThreadWrapper; class ViEDecoderObserver; class ViEEffectFilter; -class ViERTCPObserver; class ViERTPObserver; class VideoCodingModule; class VideoDecoder; @@ -56,7 +55,6 @@ class ViEChannel public VCMReceiveStatisticsCallback, public VCMDecoderTimingCallback, public VCMPacketRequestCallback, - public RtcpFeedback, public RtpFeedback, public ViEFrameProviderBase { public: @@ -162,7 +160,6 @@ class ViEChannel // Gets the CName of the incoming stream. int32_t GetRemoteRTCPCName(char rtcp_cname[]); int32_t RegisterRtpObserver(ViERTPObserver* observer); - int32_t RegisterRtcpObserver(ViERTCPObserver* observer); int32_t SendApplicationDefinedRTCPPacket( const uint8_t sub_type, uint32_t name, @@ -226,13 +223,6 @@ class ViEChannel RTPDirections direction); int32_t StopRTPDump(RTPDirections direction); - // Implements RtcpFeedback. - // TODO(pwestin) Depricate this functionality. - virtual void OnApplicationDataReceived(const int32_t id, - const uint8_t sub_type, - const uint32_t name, - const uint16_t length, - const uint8_t* data); // Implements RtpFeedback. virtual int32_t OnInitializeDecoder( const int32_t id, @@ -370,6 +360,7 @@ class ViEChannel EXCLUSIVE_LOCKS_REQUIRED(rtp_rtcp_cs_); RtpRtcp* GetRtpRtcpModule(size_t simulcast_idx) const EXCLUSIVE_LOCKS_REQUIRED(rtp_rtcp_cs_); + RtpRtcp::Configuration CreateRtpRtcpConfiguration(); RtpRtcp* CreateRtpRtcpModule(); // Assumed to be protected. int32_t StartDecodeThread(); @@ -475,7 +466,6 @@ class ViEChannel ViEDecoderObserver* codec_observer_; bool do_key_frame_callbackRequest_; ViERTPObserver* rtp_observer_; - ViERTCPObserver* rtcp_observer_; RtcpIntraFrameObserver* intra_frame_observer_; RtcpRttStats* rtt_stats_; PacedSender* paced_sender_; diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.cc b/webrtc/video_engine/vie_rtp_rtcp_impl.cc index 36e60040de..853d778168 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.cc +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.cc @@ -906,37 +906,6 @@ int ViERTP_RTCPImpl::DeregisterRTPObserver(const int video_channel) { return 0; } -int ViERTP_RTCPImpl::RegisterRTCPObserver(const int video_channel, - ViERTCPObserver& observer) { - LOG_F(LS_INFO) << "channel " << video_channel; - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); - ViEChannel* vie_channel = cs.Channel(video_channel); - if (!vie_channel) { - shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); - return -1; - } - if (vie_channel->RegisterRtcpObserver(&observer) != 0) { - shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered); - return -1; - } - return 0; -} - -int ViERTP_RTCPImpl::DeregisterRTCPObserver(const int video_channel) { - LOG_F(LS_INFO) << "channel " << video_channel; - ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); - ViEChannel* vie_channel = cs.Channel(video_channel); - if (!vie_channel) { - shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); - return -1; - } - if (vie_channel->RegisterRtcpObserver(NULL) != 0) { - shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered); - return -1; - } - return 0; -} - int ViERTP_RTCPImpl::RegisterSendChannelRtcpStatisticsCallback( int video_channel, RtcpStatisticsCallback* callback) { LOG_F(LS_INFO) << "channel " << video_channel; diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.h b/webrtc/video_engine/vie_rtp_rtcp_impl.h index 5566069b8d..99b97583ef 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.h +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.h @@ -133,9 +133,6 @@ class ViERTP_RTCPImpl virtual int RegisterRTPObserver(const int video_channel, ViERTPObserver& observer); virtual int DeregisterRTPObserver(const int video_channel); - virtual int RegisterRTCPObserver(const int video_channel, - ViERTCPObserver& observer); - virtual int DeregisterRTCPObserver(const int video_channel); virtual int RegisterSendChannelRtcpStatisticsCallback( int channel, RtcpStatisticsCallback* callback); diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 58e0055de6..d651d8f76d 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -323,36 +323,6 @@ void Channel::ResetStatistics(uint32_t ssrc) { statistics_proxy_->ResetStatistics(); } -void -Channel::OnApplicationDataReceived(int32_t id, - uint8_t subType, - uint32_t name, - uint16_t length, - const uint8_t* data) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::OnApplicationDataReceived(id=%d, subType=%u," - " name=%u, length=%u)", - id, subType, name, length); - - int32_t channel = VoEChannelId(id); - assert(channel == _channelId); - - if (_rtcpObserver) - { - CriticalSectionScoped cs(&_callbackCritSect); - - if (_rtcpObserverPtr) - { - _rtcpObserverPtr->OnApplicationDataReceived(channel, - subType, - name, - data, - length); - } - } -} - int32_t Channel::OnInitializeDecoder( int32_t id, @@ -790,10 +760,8 @@ Channel::Channel(int32_t channelId, _rxVadObserverPtr(NULL), _oldVadDecision(-1), _sendFrameType(0), - _rtcpObserverPtr(NULL), _externalMixing(false), _mixFileWithMicrophone(false), - _rtcpObserver(false), _mute(false), _panLeft(1.0f), _panRight(1.0f), @@ -832,7 +800,6 @@ Channel::Channel(int32_t channelId, configuration.id = VoEModuleId(instanceId, channelId); configuration.audio = true; configuration.outgoing_transport = this; - configuration.rtcp_feedback = this; configuration.audio_messages = this; configuration.receive_statistics = rtp_receive_statistics_.get(); configuration.bandwidth_callback = rtcp_bandwidth_observer_.get(); @@ -2872,48 +2839,6 @@ Channel::GetRxNsStatus(bool& enabled, NsModes& mode) #endif // #ifdef WEBRTC_VOICE_ENGINE_NR int -Channel::RegisterRTCPObserver(VoERTCPObserver& observer) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::RegisterRTCPObserver()"); - CriticalSectionScoped cs(&_callbackCritSect); - - if (_rtcpObserverPtr) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_OPERATION, kTraceError, - "RegisterRTCPObserver() observer already enabled"); - return -1; - } - - _rtcpObserverPtr = &observer; - _rtcpObserver = true; - - return 0; -} - -int -Channel::DeRegisterRTCPObserver() -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), - "Channel::DeRegisterRTCPObserver()"); - CriticalSectionScoped cs(&_callbackCritSect); - - if (!_rtcpObserverPtr) - { - _engineStatisticsPtr->SetLastError( - VE_INVALID_OPERATION, kTraceWarning, - "DeRegisterRTCPObserver() observer already disabled"); - return 0; - } - - _rtcpObserver = false; - _rtcpObserverPtr = NULL; - - return 0; -} - -int Channel::SetLocalSSRC(unsigned int ssrc) { WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index 1c2fc4ac8d..94a34328c0 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -59,7 +59,6 @@ class RtpRtcp; class TelephoneEventHandler; class ViENetwork; class VoEMediaProcess; -class VoERTCPObserver; class VoERTPObserver; class VoiceEngineObserver; @@ -156,7 +155,6 @@ private: class Channel: public RtpData, public RtpFeedback, - public RtcpFeedback, public FileCallback, // receiving notification from file player & recorder public Transport, public RtpAudioFeedback, @@ -314,8 +312,6 @@ public: #endif // VoERTP_RTCP - int RegisterRTCPObserver(VoERTCPObserver& observer); - int DeRegisterRTCPObserver(); int SetLocalSSRC(unsigned int ssrc); int GetLocalSSRC(unsigned int& ssrc); int GetRemoteSSRC(unsigned int& ssrc); @@ -386,13 +382,6 @@ public: uint32_t CSRC, bool added) OVERRIDE; virtual void ResetStatistics(uint32_t ssrc) OVERRIDE; - // From RtcpFeedback in the RTP/RTCP module - virtual void OnApplicationDataReceived(int32_t id, - uint8_t subType, - uint32_t name, - uint16_t length, - const uint8_t* data) OVERRIDE; - // From RtpAudioFeedback in the RTP/RTCP module virtual void OnPlayTelephoneEvent(int32_t id, uint8_t event, @@ -565,11 +554,9 @@ private: VoERxVadCallback* _rxVadObserverPtr; int32_t _oldVadDecision; int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise - VoERTCPObserver* _rtcpObserverPtr; // VoEBase bool _externalMixing; bool _mixFileWithMicrophone; - bool _rtcpObserver; // VoEVolumeControl bool _mute; float _panLeft; diff --git a/webrtc/voice_engine/include/voe_rtp_rtcp.h b/webrtc/voice_engine/include/voe_rtp_rtcp.h index 6223bd6e0b..c5ab861509 100644 --- a/webrtc/voice_engine/include/voe_rtp_rtcp.h +++ b/webrtc/voice_engine/include/voe_rtp_rtcp.h @@ -61,19 +61,6 @@ protected: virtual ~VoERTPObserver() {} }; -// VoERTCPObserver -class WEBRTC_DLLEXPORT VoERTCPObserver -{ -public: - virtual void OnApplicationDataReceived( - int channel, unsigned char subType, - unsigned int name, const unsigned char* data, - unsigned short dataLengthInBytes) = 0; - -protected: - virtual ~VoERTCPObserver() {} -}; - // CallStatistics struct CallStatistics { @@ -268,9 +255,6 @@ public: virtual int RegisterRTPObserver(int channel, VoERTPObserver& observer) { return -1; }; virtual int DeRegisterRTPObserver(int channel) { return -1; }; - virtual int RegisterRTCPObserver( - int channel, VoERTCPObserver& observer) { return -1; }; - virtual int DeRegisterRTCPObserver(int channel) { return -1; }; virtual int GetRemoteCSRCs(int channel, unsigned int arrCSRC[15]) { return -1; }; virtual int InsertExtraRTPPacket( diff --git a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc index 9a732c0e2b..5ba84216e5 100644 --- a/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc +++ b/webrtc/voice_engine/test/auto_test/standard/rtp_rtcp_test.cc @@ -55,23 +55,6 @@ void TestRtpObserver::OnIncomingSSRCChanged(int channel, } } -class RtcpAppHandler : public webrtc::VoERTCPObserver { - public: - RtcpAppHandler() : length_in_bytes_(0), sub_type_(0), name_(0) {} - void OnApplicationDataReceived(int channel, - unsigned char sub_type, - unsigned int name, - const unsigned char* data, - unsigned short length_in_bytes); - void Reset(); - ~RtcpAppHandler() {} - unsigned short length_in_bytes_; - unsigned char data_[256]; - unsigned char sub_type_; - unsigned int name_; -}; - - static const char* const RTCP_CNAME = "Whatever"; class RtpRtcpTest : public AfterStreamingFixture { @@ -104,23 +87,6 @@ class RtpRtcpTest : public AfterStreamingFixture { LoopBackTransport* transport_; }; -void RtcpAppHandler::OnApplicationDataReceived( - const int /*channel*/, unsigned char sub_type, - unsigned int name, const unsigned char* data, - unsigned short length_in_bytes) { - length_in_bytes_ = length_in_bytes; - memcpy(data_, &data[0], length_in_bytes); - sub_type_ = sub_type; - name_ = name; -} - -void RtcpAppHandler::Reset() { - length_in_bytes_ = 0; - memset(data_, 0, sizeof(data_)); - sub_type_ = 0; - name_ = 0; -} - TEST_F(RtpRtcpTest, RemoteRtcpCnameHasPropagatedToRemoteSide) { if (!FLAGS_include_timing_dependent_tests) { TEST_LOG("Skipping test - running in slow execution environment...\n"); |