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}
This commit is contained in:
Peter Boström 2015-06-18 19:00:34 +02:00
parent ff4ea9310e
commit ae37abbf6a
7 changed files with 63 additions and 51 deletions

View File

@ -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",

View File

@ -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<int>(frame_times_.size()); }
int last_processing_time_ms() const { return last_processing_time_ms_; }
private:

View File

@ -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<uint32_t>(
(aggregate.jitter + report_blocks.size() / 2) / report_blocks.size());
return aggregate;
}

View File

@ -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': [

View File

@ -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<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 @@ 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<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 @@ 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<int>(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<size_t>(video_codec.numberOfSimulcastStreams - 1);
j--) {
RtpRtcp* rtp_rtcp = simulcast_rtp_rtcp_.back();
deregistered_modules.push_back(rtp_rtcp);
rtp_rtcp->SetSendingStatus(false);

View File

@ -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<uint32_t>(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(&current_send_codec, number_of_cores_,
max_data_payload_length) != VCM_OK) {
if (vcm_->RegisterSendCodec(
&current_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 @@ 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<uint32_t>(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<uint32_t>(max_payload_length)) !=
0) {
return -1;
}
}

View File

@ -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<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));
}
}