Remove implicit-int-conversion warnings.
BUG=webrtc:1348, webrtc:261
R=stefan@webrtc.org
Review URL: https://codereview.webrtc.org/1184443005.
Cr-Commit-Position: refs/heads/master@{#9464}
diff --git a/webrtc/video_engine/BUILD.gn b/webrtc/video_engine/BUILD.gn
index 8a805f7..b098227 100644
--- a/webrtc/video_engine/BUILD.gn
+++ b/webrtc/video_engine/BUILD.gn
@@ -54,16 +54,6 @@
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 88d5d05..23ee59f 100644
--- a/webrtc/video_engine/overuse_frame_detector.cc
+++ b/webrtc/video_engine/overuse_frame_detector.cc
@@ -250,7 +250,7 @@
}
void Reset() { frame_times_.clear(); }
- int NumFrames() const { return frame_times_.size(); }
+ int NumFrames() const { return static_cast<int>(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 ea18e83..6df6288 100644
--- a/webrtc/video_engine/report_block_stats.cc
+++ b/webrtc/video_engine/report_block_stats.cc
@@ -70,8 +70,8 @@
// 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<uint32_t>(
+ (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 dc95671..4d295ae 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 9c6b152..61096b3 100644
--- a/webrtc/video_engine/vie_channel.cc
+++ b/webrtc/video_engine/vie_channel.cc
@@ -271,23 +271,32 @@
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<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
+ 1000));
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.MediaBitrateReceivedInKbps",
+ static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.PaddingBitrateReceivedInKbps",
+ static_cast<int>(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<int>(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<int>(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<int>(rtp_rtx.fec.TotalBytes() *
+ 8 / elapsed_sec / 1000));
}
}
}
@@ -305,25 +314,34 @@
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<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec /
+ 1000));
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.MediaBitrateSentInKbps",
+ static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000));
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.PaddingBitrateSentInKbps",
+ static_cast<int>(rtp_rtx.transmitted.padding_bytes * 8 / elapsed_sec /
+ 1000));
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.RetransmittedBitrateSentInKbps",
+ static_cast<int>(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<int>(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<int>(rtp_rtx.fec.TotalBytes() * 8 / elapsed_sec / 1000));
}
}
@@ -375,8 +393,8 @@
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<int>(simulcast_rtp_rtcp_.size()) - 1;
if (num_modules_to_add < 0) {
num_modules_to_add = 0;
}
@@ -425,8 +443,9 @@
}
// 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<size_t>(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 3ee5bae..7ed207f 100644
--- a/webrtc/video_engine/vie_encoder.cc
+++ b/webrtc/video_engine/vie_encoder.cc
@@ -163,8 +163,9 @@
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<uint32_t>(PayloadRouter::DefaultMaxPayloadLength())) !=
0) {
return false;
}
@@ -298,8 +299,9 @@
// 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<uint32_t>(max_data_payload_length)) != VCM_OK) {
LOG(LS_INFO) << "De-registered the currently used external encoder ("
<< static_cast<int>(pl_type) << ") and therefore tried to "
<< "register the corresponding internal encoder, but none "
@@ -354,7 +356,8 @@
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<uint32_t>(max_data_payload_length)) !=
+ VCM_OK) {
return -1;
}
return 0;
@@ -627,7 +630,8 @@
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<uint32_t>(max_payload_length)) !=
+ 0) {
return -1;
}
}
diff --git a/webrtc/video_engine/vie_receiver.cc b/webrtc/video_engine/vie_receiver.cc
index a1baf29..18b6e34 100644
--- a/webrtc/video_engine/vie_receiver.cc
+++ b/webrtc/video_engine/vie_receiver.cc
@@ -69,13 +69,14 @@
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<int>(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<int>(counter.num_recovered_packets *
+ 100 / counter.num_fec_packets));
}
}