diff --git a/webrtc/video_engine/BUILD.gn b/webrtc/video_engine/BUILD.gn index 8a805f7bf..b0982277d 100644 --- a/webrtc/video_engine/BUILD.gn +++ b/webrtc/video_engine/BUILD.gn @@ -54,16 +54,6 @@ source_set("video_engine_core") { configs -= [ "//build/config/clang:find_bad_constructs" ] } - if (is_win) { - cflags = [ - # TODO(jschuh): Bug 1348: fix size_t to int truncations. - "/wd4267", # size_t to int truncation. - - # Bug 261. - "/wd4373", # legacy warning for ignoring const / volatile in signatures. - ] - } - deps = [ "..:webrtc_common", "../common_video", diff --git a/webrtc/video_engine/overuse_frame_detector.cc b/webrtc/video_engine/overuse_frame_detector.cc index 88d5d052b..23ee59f21 100644 --- a/webrtc/video_engine/overuse_frame_detector.cc +++ b/webrtc/video_engine/overuse_frame_detector.cc @@ -250,7 +250,7 @@ class OveruseFrameDetector::FrameQueue { } void Reset() { frame_times_.clear(); } - int NumFrames() const { return frame_times_.size(); } + int NumFrames() const { return static_cast(frame_times_.size()); } int last_processing_time_ms() const { return last_processing_time_ms_; } private: diff --git a/webrtc/video_engine/report_block_stats.cc b/webrtc/video_engine/report_block_stats.cc index ea18e830e..6df62882d 100644 --- a/webrtc/video_engine/report_block_stats.cc +++ b/webrtc/video_engine/report_block_stats.cc @@ -70,8 +70,8 @@ RTCPReportBlock ReportBlockStats::AggregateAndStore( // Fraction lost since previous report block. aggregate.fractionLost = FractionLost(num_lost_sequence_numbers, num_sequence_numbers); - aggregate.jitter = - (aggregate.jitter + report_blocks.size() / 2) / report_blocks.size(); + aggregate.jitter = static_cast( + (aggregate.jitter + report_blocks.size() / 2) / report_blocks.size()); return aggregate; } diff --git a/webrtc/video_engine/video_engine_core.gypi b/webrtc/video_engine/video_engine_core.gypi index dc956714f..4d295ae9e 100644 --- a/webrtc/video_engine/video_engine_core.gypi +++ b/webrtc/video_engine/video_engine_core.gypi @@ -66,8 +66,6 @@ 'vie_remb.cc', 'vie_sync_module.cc', ], # source - # TODO(jschuh): Bug 1348: fix size_t to int truncations. - 'msvs_disabled_warnings': [ 4267, ], }, ], # targets 'conditions': [ diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 9c6b15250..61096b396 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -271,23 +271,32 @@ void ViEChannel::UpdateHistograms() { rtp_rtx.Add(rtx); elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; if (elapsed_sec > metrics::kMinRunTimeInSeconds) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.BitrateReceivedInKbps", - rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.MediaBitrateReceivedInKbps", - rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PaddingBitrateReceivedInKbps", - rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 1000); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.BitrateReceivedInKbps", + static_cast(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / + 1000)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.MediaBitrateReceivedInKbps", + static_cast(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.PaddingBitrateReceivedInKbps", + static_cast(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / + 1000)); RTC_HISTOGRAM_COUNTS_10000( "WebRTC.Video.RetransmittedBitrateReceivedInKbps", - rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 1000); + static_cast(rtp_rtx.retransmitted.TotalBytes() * 8 / + elapsed_sec / 1000)); uint32_t ssrc = 0; if (vie_receiver_.GetRtxSsrc(&ssrc)) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateReceivedInKbps", - rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.RtxBitrateReceivedInKbps", + static_cast(rtx.transmitted.TotalBytes() * 8 / elapsed_sec / + 1000)); } if (vie_receiver_.IsFecEnabled()) { RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateReceivedInKbps", - rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000); + static_cast(rtp_rtx.fec.TotalBytes() * + 8 / elapsed_sec / 1000)); } } } @@ -305,25 +314,34 @@ void ViEChannel::UpdateHistogramsAtStopSend() { if (elapsed_sec < metrics::kMinRunTimeInSeconds) { return; } - RTC_HISTOGRAM_COUNTS_100000("WebRTC.Video.BitrateSentInKbps", - rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.MediaBitrateSentInKbps", - rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PaddingBitrateSentInKbps", - rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / 1000); - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RetransmittedBitrateSentInKbps", - rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / 1000); + RTC_HISTOGRAM_COUNTS_100000( + "WebRTC.Video.BitrateSentInKbps", + static_cast(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / + 1000)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.MediaBitrateSentInKbps", + static_cast(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.PaddingBitrateSentInKbps", + static_cast(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec / + 1000)); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.RetransmittedBitrateSentInKbps", + static_cast(rtp_rtx.retransmitted.TotalBytes() * 8 / elapsed_sec / + 1000)); if (rtp_rtcp_->RtxSendStatus() != kRtxOff) { RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.RtxBitrateSentInKbps", - rtx.transmitted.TotalBytes() * 8 / elapsed_sec / 1000); + static_cast(rtx.transmitted.TotalBytes() * + 8 / elapsed_sec / 1000)); } bool fec_enabled = false; uint8_t pltype_red; uint8_t pltype_fec; rtp_rtcp_->GenericFECStatus(fec_enabled, pltype_red, pltype_fec); if (fec_enabled) { - RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", - rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000); + RTC_HISTOGRAM_COUNTS_10000( + "WebRTC.Video.FecBitrateSentInKbps", + static_cast(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000)); } } @@ -375,8 +393,8 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, if (video_codec.numberOfSimulcastStreams > 0) { // Set correct bitrate to base layer. // Create our simulcast RTP modules. - int num_modules_to_add = - video_codec.numberOfSimulcastStreams - simulcast_rtp_rtcp_.size() - 1; + int num_modules_to_add = video_codec.numberOfSimulcastStreams - + static_cast(simulcast_rtp_rtcp_.size()) - 1; if (num_modules_to_add < 0) { num_modules_to_add = 0; } @@ -425,8 +443,9 @@ int32_t ViEChannel::SetSendCodec(const VideoCodec& video_codec, } // Remove last in list if we have too many. - for (int j = simulcast_rtp_rtcp_.size(); - j > (video_codec.numberOfSimulcastStreams - 1); j--) { + for (size_t j = simulcast_rtp_rtcp_.size(); + j > static_cast(video_codec.numberOfSimulcastStreams - 1); + j--) { RtpRtcp* rtp_rtcp = simulcast_rtp_rtcp_.back(); deregistered_modules.push_back(rtp_rtcp); rtp_rtcp->SetSendingStatus(false); diff --git a/webrtc/video_engine/vie_encoder.cc b/webrtc/video_engine/vie_encoder.cc index 3ee5bae84..7ed207fd5 100644 --- a/webrtc/video_engine/vie_encoder.cc +++ b/webrtc/video_engine/vie_encoder.cc @@ -163,8 +163,9 @@ bool ViEEncoder::Init() { CriticalSectionScoped cs(data_cs_.get()); send_padding_ = video_codec.numberOfSimulcastStreams > 1; } - if (vcm_->RegisterSendCodec(&video_codec, number_of_cores_, - PayloadRouter::DefaultMaxPayloadLength()) != + if (vcm_->RegisterSendCodec( + &video_codec, number_of_cores_, + static_cast(PayloadRouter::DefaultMaxPayloadLength())) != 0) { return false; } @@ -298,8 +299,9 @@ int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { // for realz. https://code.google.com/p/chromium/issues/detail?id=348222 current_send_codec.extra_options = NULL; size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); - if (vcm_->RegisterSendCodec(¤t_send_codec, number_of_cores_, - max_data_payload_length) != VCM_OK) { + if (vcm_->RegisterSendCodec( + ¤t_send_codec, number_of_cores_, + static_cast(max_data_payload_length)) != VCM_OK) { LOG(LS_INFO) << "De-registered the currently used external encoder (" << static_cast(pl_type) << ") and therefore tried to " << "register the corresponding internal encoder, but none " @@ -354,7 +356,8 @@ int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { size_t max_data_payload_length = send_payload_router_->MaxPayloadLength(); if (vcm_->RegisterSendCodec(&modified_video_codec, number_of_cores_, - max_data_payload_length) != VCM_OK) { + static_cast(max_data_payload_length)) != + VCM_OK) { return -1; } return 0; @@ -627,7 +630,8 @@ int32_t ViEEncoder::UpdateProtectionMethod(bool nack, bool fec) { codec.startBitrate = (current_bitrate_bps + 500) / 1000; size_t max_payload_length = send_payload_router_->MaxPayloadLength(); if (vcm_->RegisterSendCodec(&codec, number_of_cores_, - max_payload_length) != 0) { + static_cast(max_payload_length)) != + 0) { return -1; } } diff --git a/webrtc/video_engine/vie_receiver.cc b/webrtc/video_engine/vie_receiver.cc index a1baf2984..18b6e347a 100644 --- a/webrtc/video_engine/vie_receiver.cc +++ b/webrtc/video_engine/vie_receiver.cc @@ -69,13 +69,14 @@ ViEReceiver::~ViEReceiver() { void ViEReceiver::UpdateHistograms() { FecPacketCounter counter = fec_receiver_->GetPacketCounter(); if (counter.num_packets > 0) { - RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.ReceivedFecPacketsInPercent", - counter.num_fec_packets * 100 / counter.num_packets); + RTC_HISTOGRAM_PERCENTAGE( + "WebRTC.Video.ReceivedFecPacketsInPercent", + static_cast(counter.num_fec_packets * 100 / counter.num_packets)); } if (counter.num_fec_packets > 0) { - RTC_HISTOGRAM_PERCENTAGE( - "WebRTC.Video.RecoveredMediaPacketsInPercentOfFec", - counter.num_recovered_packets * 100 / counter.num_fec_packets); + RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.RecoveredMediaPacketsInPercentOfFec", + static_cast(counter.num_recovered_packets * + 100 / counter.num_fec_packets)); } }