From 9d8b71e4c094efb73837fb90ad8669b811c6845a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bostr=C3=B6m?= Date: Mon, 18 May 2015 11:48:31 +0200 Subject: [PATCH] Remove some dead code in ViEChannel. BUG=1695 R=asapersson@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/54429004 Cr-Commit-Position: refs/heads/master@{#9203} --- webrtc/video_engine/vie_channel.cc | 151 +---------------------------- webrtc/video_engine/vie_channel.h | 49 +--------- 2 files changed, 2 insertions(+), 198 deletions(-) diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index f0cc56c159..86fe598aed 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -130,8 +130,7 @@ ViEChannel::ViEChannel(int32_t channel_id, nack_history_size_sender_(kSendSidePacketHistorySize), max_nack_reordering_threshold_(kMaxPacketAgeToNack), pre_render_callback_(NULL), - report_block_stats_sender_(new ReportBlockStats()), - report_block_stats_receiver_(new ReportBlockStats()) { + report_block_stats_sender_(new ReportBlockStats()) { RtpRtcp::Configuration configuration = CreateRtpRtcpConfiguration(); configuration.remote_bitrate_estimator = remote_bitrate_estimator; configuration.receive_statistics = vie_receiver_.GetReceiveStatistics(); @@ -264,11 +263,6 @@ void ViEChannel::UpdateHistograms() { RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", rtcp_counter.UniqueNackRequestsInPercent()); } - int fraction_lost = report_block_stats_receiver_->FractionLostInPercent(); - if (fraction_lost != -1) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedPacketsLostInPercent", - fraction_lost); - } } StreamDataCounters rtp; @@ -574,13 +568,6 @@ int32_t ViEChannel::SetReceiveCodec(const VideoCodec& video_codec) { return 0; } -int32_t ViEChannel::GetReceiveCodec(VideoCodec* video_codec) { - if (vcm_->ReceiveCodec(video_codec) != 0) { - return -1; - } - return 0; -} - int32_t ViEChannel::RegisterCodecObserver(ViEDecoderObserver* observer) { CriticalSectionScoped cs(callback_cs_.get()); if (observer) { @@ -675,10 +662,6 @@ void ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { rtp_rtcp_->SetRTCPStatus(rtcp_mode); } -RTCPMethod ViEChannel::GetRTCPMode() const { - return rtp_rtcp_->RTCP(); -} - int32_t ViEChannel::SetNACKStatus(const bool enable) { // Update the decoding VCM. if (vcm_->SetVideoProtection(kProtectionNack, enable) != VCM_OK) { @@ -1022,17 +1005,6 @@ int32_t ViEChannel::GetRemoteSSRC(uint32_t* ssrc) { return 0; } -int32_t ViEChannel::GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]) { - uint32_t arrayCSRC[kRtpCsrcSize]; - memset(arrayCSRC, 0, sizeof(arrayCSRC)); - - int num_csrcs = vie_receiver_.GetCsrcs(arrayCSRC); - if (num_csrcs > 0) { - memcpy(CSRCs, arrayCSRC, num_csrcs * sizeof(uint32_t)); - } - return 0; -} - int ViEChannel::SetRtxSendPayloadType(int payload_type, int associated_payload_type) { rtp_rtcp_->SetRtxSendPayloadType(payload_type, associated_payload_type); @@ -1209,38 +1181,6 @@ void ViEChannel::RegisterSendChannelRtcpStatisticsCallback( } } -// TODO(holmer): This is a bad function name as it implies that it returns the -// received RTCP, while it actually returns the statistics which will be sent -// in the RTCP. -int32_t ViEChannel::GetReceivedRtcpStatistics(uint16_t* fraction_lost, - uint32_t* cumulative_lost, - uint32_t* extended_max, - uint32_t* jitter_samples, - int64_t* rtt_ms) { - uint32_t remote_ssrc = vie_receiver_.GetRemoteSsrc(); - StreamStatistician* statistician = - vie_receiver_.GetReceiveStatistics()->GetStatistician(remote_ssrc); - RtcpStatistics receive_stats; - if (!statistician || !statistician->GetStatistics( - &receive_stats, rtp_rtcp_->RTCP() == kRtcpOff)) { - return -1; - } - *fraction_lost = receive_stats.fraction_lost; - *cumulative_lost = receive_stats.cumulative_lost; - *extended_max = receive_stats.extended_max_sequence_number; - *jitter_samples = receive_stats.jitter; - - // TODO(asapersson): Change report_block_stats to not rely on - // GetReceivedRtcpStatistics to be called. - report_block_stats_receiver_->Store(receive_stats, remote_ssrc, 0); - - int64_t dummy = 0; - int64_t rtt = 0; - rtp_rtcp_->RTT(remote_ssrc, &rtt, &dummy, &dummy, &dummy); - *rtt_ms = rtt; - return 0; -} - void ViEChannel::RegisterReceiveChannelRtcpStatisticsCallback( RtcpStatisticsCallback* callback) { vie_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback( @@ -1253,42 +1193,6 @@ void ViEChannel::RegisterRtcpPacketTypeCounterObserver( rtcp_packet_type_counter_observer_.Set(observer); } -int32_t ViEChannel::GetRtpStatistics(size_t* bytes_sent, - uint32_t* packets_sent, - size_t* bytes_received, - uint32_t* packets_received) const { - StreamStatistician* statistician = vie_receiver_.GetReceiveStatistics()-> - GetStatistician(vie_receiver_.GetRemoteSsrc()); - *bytes_received = 0; - *packets_received = 0; - if (statistician) - statistician->GetDataCounters(bytes_received, packets_received); - if (rtp_rtcp_->DataCountersRTP(bytes_sent, packets_sent) != 0) { - return -1; - } - CriticalSectionScoped cs(rtp_rtcp_cs_.get()); - for (std::list::const_iterator it = simulcast_rtp_rtcp_.begin(); - it != simulcast_rtp_rtcp_.end(); - it++) { - size_t bytes_sent_temp = 0; - uint32_t packets_sent_temp = 0; - RtpRtcp* rtp_rtcp = *it; - rtp_rtcp->DataCountersRTP(&bytes_sent_temp, &packets_sent_temp); - *bytes_sent += bytes_sent_temp; - *packets_sent += packets_sent_temp; - } - for (std::list::const_iterator it = removed_rtp_rtcp_.begin(); - it != removed_rtp_rtcp_.end(); ++it) { - size_t bytes_sent_temp = 0; - uint32_t packets_sent_temp = 0; - RtpRtcp* rtp_rtcp = *it; - rtp_rtcp->DataCountersRTP(&bytes_sent_temp, &packets_sent_temp); - *bytes_sent += bytes_sent_temp; - *packets_sent += packets_sent_temp; - } - return 0; -} - void ViEChannel::GetSendStreamDataCounters( StreamDataCounters* rtp_counters, StreamDataCounters* rtx_counters) const { @@ -1380,59 +1284,6 @@ void ViEChannel::GetReceiveRtcpPacketTypeCounter( *packet_counter = counter; } -void ViEChannel::GetBandwidthUsage(uint32_t* total_bitrate_sent, - uint32_t* video_bitrate_sent, - uint32_t* fec_bitrate_sent, - uint32_t* nackBitrateSent) const { - rtp_rtcp_->BitrateSent(total_bitrate_sent, video_bitrate_sent, - fec_bitrate_sent, nackBitrateSent); - CriticalSectionScoped cs(rtp_rtcp_cs_.get()); - for (std::list::const_iterator it = simulcast_rtp_rtcp_.begin(); - it != simulcast_rtp_rtcp_.end(); it++) { - uint32_t stream_rate = 0; - uint32_t video_rate = 0; - uint32_t fec_rate = 0; - uint32_t nackRate = 0; - RtpRtcp* rtp_rtcp = *it; - rtp_rtcp->BitrateSent(&stream_rate, &video_rate, &fec_rate, &nackRate); - *total_bitrate_sent += stream_rate; - *video_bitrate_sent += video_rate; - *fec_bitrate_sent += fec_rate; - *nackBitrateSent += nackRate; - } -} - -bool ViEChannel::GetSendSideDelay(int* avg_send_delay, - int* max_send_delay) const { - *avg_send_delay = 0; - *max_send_delay = 0; - bool valid_estimate = false; - int num_send_delays = 0; - if (rtp_rtcp_->GetSendSideDelay(avg_send_delay, max_send_delay)) { - ++num_send_delays; - valid_estimate = true; - } - CriticalSectionScoped cs(rtp_rtcp_cs_.get()); - for (std::list::const_iterator it = simulcast_rtp_rtcp_.begin(); - it != simulcast_rtp_rtcp_.end(); it++) { - RtpRtcp* rtp_rtcp = *it; - int sub_stream_avg_delay = 0; - int sub_stream_max_delay = 0; - if (rtp_rtcp->GetSendSideDelay(&sub_stream_avg_delay, - &sub_stream_max_delay)) { - *avg_send_delay += sub_stream_avg_delay; - *max_send_delay = std::max(*max_send_delay, sub_stream_max_delay); - ++num_send_delays; - } - } - if (num_send_delays > 0) { - valid_estimate = true; - *avg_send_delay = *avg_send_delay / num_send_delays; - *avg_send_delay = (*avg_send_delay + num_send_delays / 2) / num_send_delays; - } - return valid_estimate; -} - void ViEChannel::RegisterSendSideDelayObserver( SendSideDelayObserver* observer) { send_side_delay_observer_.Set(observer); diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index e5aed5c2cb..05550caa8e 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -125,7 +125,6 @@ class ViEChannel // type has changed and we should start a new RTP stream. int32_t SetSendCodec(const VideoCodec& video_codec, bool new_stream = true); int32_t SetReceiveCodec(const VideoCodec& video_codec); - int32_t GetReceiveCodec(VideoCodec* video_codec); int32_t RegisterCodecObserver(ViEDecoderObserver* observer); // Registers an external decoder. |buffered_rendering| means that the decoder // will render frames after decoding according to the render timestamp @@ -152,7 +151,6 @@ class ViEChannel int32_t SetSignalPacketLossStatus(bool enable, bool only_key_frames); void SetRTCPMode(const RTCPMethod rtcp_mode); - RTCPMethod GetRTCPMode() const; int32_t SetNACKStatus(const bool enable); int32_t SetFECStatus(const bool enable, const unsigned char payload_typeRED, @@ -169,7 +167,6 @@ class ViEChannel int SetReceiveTimestampOffsetStatus(bool enable, int id); int SetSendAbsoluteSendTimeStatus(bool enable, int id); int SetReceiveAbsoluteSendTimeStatus(bool enable, int id); - bool GetReceiveAbsoluteSendTimeStatus() const; int SetSendVideoRotationStatus(bool enable, int id); int SetReceiveVideoRotationStatus(bool enable, int id); void SetRtcpXrRrtrStatus(bool enable); @@ -188,9 +185,6 @@ class ViEChannel // Gets SSRC for the incoming stream. int32_t GetRemoteSSRC(uint32_t* ssrc); - // Gets the CSRC for the incoming stream. - int32_t GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]); - int SetRtxSendPayloadType(int payload_type, int associated_payload_type); void SetRtxReceivePayloadType(int payload_type, int associated_payload_type); @@ -212,6 +206,7 @@ class ViEChannel uint16_t data_length_in_bytes); // Returns statistics reported by the remote client in an RTCP packet. + // TODO(pbos): Remove this along with VideoSendStream::GetRtt(). int32_t GetSendRtcpStatistics(uint16_t* fraction_lost, uint32_t* cumulative_lost, uint32_t* extended_max, @@ -222,23 +217,10 @@ class ViEChannel void RegisterSendChannelRtcpStatisticsCallback( RtcpStatisticsCallback* callback); - // Returns our localy created statistics of the received RTP stream. - int32_t GetReceivedRtcpStatistics(uint16_t* fraction_lost, - uint32_t* cumulative_lost, - uint32_t* extended_max, - uint32_t* jitter_samples, - int64_t* rtt_ms); - // Called on generation of RTCP stats void RegisterReceiveChannelRtcpStatisticsCallback( RtcpStatisticsCallback* callback); - // Gets sent/received packets statistics. - int32_t GetRtpStatistics(size_t* bytes_sent, - uint32_t* packets_sent, - size_t* bytes_received, - uint32_t* packets_received) const; - // Gets send statistics for the rtp and rtx stream. void GetSendStreamDataCounters(StreamDataCounters* rtp_counters, StreamDataCounters* rtx_counters) const; @@ -261,13 +243,6 @@ class ViEChannel void GetReceiveRtcpPacketTypeCounter( RtcpPacketTypeCounter* packet_counter) const; - void GetBandwidthUsage(uint32_t* total_bitrate_sent, - uint32_t* video_bitrate_sent, - uint32_t* fec_bitrate_sent, - uint32_t* nackBitrateSent) const; - // TODO(holmer): Deprecated. We should use the SendSideDelayObserver instead - // to avoid deadlocks. - bool GetSendSideDelay(int* avg_send_delay, int* max_send_delay) const; void RegisterSendSideDelayObserver(SendSideDelayObserver* observer); // Called on any new send bitrate estimate. @@ -292,27 +267,6 @@ class ViEChannel const bool added); virtual void ResetStatistics(uint32_t); - int32_t SetLocalReceiver(const uint16_t rtp_port, - const uint16_t rtcp_port, - const char* ip_address); - int32_t GetLocalReceiver(uint16_t* rtp_port, - uint16_t* rtcp_port, - char* ip_address) const; - int32_t SetSendDestination(const char* ip_address, - const uint16_t rtp_port, - const uint16_t rtcp_port, - const uint16_t source_rtp_port, - const uint16_t source_rtcp_port); - int32_t GetSendDestination(char* ip_address, - uint16_t* rtp_port, - uint16_t* rtcp_port, - uint16_t* source_rtp_port, - uint16_t* source_rtcp_port) const; - int32_t GetSourceInfo(uint16_t* rtp_port, - uint16_t* rtcp_port, - char* ip_address, - uint32_t ip_address_length); - int32_t SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC); int32_t StartSend(); @@ -586,7 +540,6 @@ class ViEChannel I420FrameCallback* pre_render_callback_; rtc::scoped_ptr report_block_stats_sender_; - rtc::scoped_ptr report_block_stats_receiver_; }; } // namespace webrtc