Skip to content

Commit

Permalink
[LibWebRTC] Build fails with clang-18 on Linux
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271752

Reviewed by Youenn Fablet.

Fix -Wc++11-narrowing-const-reference warnings in LibWebRTC legacy stats collector.

* Source/ThirdParty/libwebrtc/Source/webrtc/pc/legacy_stats_collector.cc:

Canonical link: https://commits.webkit.org/276753@main
  • Loading branch information
philn committed Mar 27, 2024
1 parent 75d98d9 commit 753783a
Showing 1 changed file with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ void ExtractStats(const cricket::VoiceReceiverInfo& info,
{StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate},
{StatsReport::kStatsValueNamePreemptiveExpandRate,
info.preemptive_expand_rate},
{StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy},
{StatsReport::kStatsValueNameTotalAudioEnergy, static_cast<float>(info.total_output_energy)},
{StatsReport::kStatsValueNameTotalSamplesDuration,
info.total_output_duration}};
static_cast<float>(info.total_output_duration)}};

const IntForAdd ints[] = {
{StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms},
Expand Down Expand Up @@ -244,9 +244,9 @@ void ExtractStats(const cricket::VoiceSenderInfo& info,
SetAudioProcessingStats(report, info.apm_statistics);

const FloatForAdd floats[] = {
{StatsReport::kStatsValueNameTotalAudioEnergy, info.total_input_energy},
{StatsReport::kStatsValueNameTotalAudioEnergy, static_cast<float>(info.total_input_energy)},
{StatsReport::kStatsValueNameTotalSamplesDuration,
info.total_input_duration}};
static_cast<float>(info.total_input_duration)}};

RTC_DCHECK_GE(info.audio_level, 0);
const IntForAdd ints[] = {
Expand Down Expand Up @@ -340,7 +340,7 @@ void ExtractStats(const cricket::VideoReceiverInfo& info,
{StatsReport::kStatsValueNamePlisSent, info.plis_sent},
{StatsReport::kStatsValueNameRenderDelayMs, info.render_delay_ms},
{StatsReport::kStatsValueNameTargetDelayMs, info.target_delay_ms},
{StatsReport::kStatsValueNameFramesDecoded, info.frames_decoded},
{StatsReport::kStatsValueNameFramesDecoded, static_cast<int>(info.frames_decoded)},
};

for (const auto& i : ints)
Expand Down Expand Up @@ -384,15 +384,15 @@ void ExtractStats(const cricket::VideoSenderInfo& info,
info.encode_usage_percent},
{StatsReport::kStatsValueNameFirsReceived, info.firs_received},
{StatsReport::kStatsValueNameFrameHeightSent, info.send_frame_height},
{StatsReport::kStatsValueNameFrameRateInput, round(info.framerate_input)},
{StatsReport::kStatsValueNameFrameRateInput, static_cast<int>(round(info.framerate_input))},
{StatsReport::kStatsValueNameFrameRateSent, info.framerate_sent},
{StatsReport::kStatsValueNameFrameWidthSent, info.send_frame_width},
{StatsReport::kStatsValueNameNacksReceived, info.nacks_received},
{StatsReport::kStatsValueNameNacksReceived, static_cast<int>(info.nacks_received)},
{StatsReport::kStatsValueNamePacketsLost, info.packets_lost},
{StatsReport::kStatsValueNamePacketsSent, info.packets_sent},
{StatsReport::kStatsValueNamePlisReceived, info.plis_received},
{StatsReport::kStatsValueNameFramesEncoded, info.frames_encoded},
{StatsReport::kStatsValueNameHugeFramesSent, info.huge_frames_sent},
{StatsReport::kStatsValueNameFramesEncoded, static_cast<int>(info.frames_encoded)},
{StatsReport::kStatsValueNameHugeFramesSent, static_cast<int>(info.huge_frames_sent)},
};

for (const auto& i : ints)
Expand Down Expand Up @@ -780,19 +780,25 @@ StatsReport* LegacyStatsCollector::AddConnectionInfoReport(
AddCandidateReport(remote_candidate_stats, false)->id());

const Int64ForAdd int64s[] = {
{StatsReport::kStatsValueNameBytesReceived, info.recv_total_bytes},
{StatsReport::kStatsValueNameBytesSent, info.sent_total_bytes},
{StatsReport::kStatsValueNamePacketsSent, info.sent_total_packets},
{StatsReport::kStatsValueNameRtt, info.rtt},
{StatsReport::kStatsValueNameBytesReceived,
static_cast<int64_t>(info.recv_total_bytes)},
{StatsReport::kStatsValueNameBytesSent,
static_cast<int64_t>(info.sent_total_bytes)},
{StatsReport::kStatsValueNamePacketsSent,
static_cast<int64_t>(info.sent_total_packets)},
{StatsReport::kStatsValueNameRtt, static_cast<int64_t>(info.rtt)},
{StatsReport::kStatsValueNameSendPacketsDiscarded,
info.sent_discarded_packets},
static_cast<int64_t>(info.sent_discarded_packets)},
{StatsReport::kStatsValueNameSentPingRequestsTotal,
info.sent_ping_requests_total},
static_cast<int64_t>(info.sent_ping_requests_total)},
{StatsReport::kStatsValueNameSentPingRequestsBeforeFirstResponse,
info.sent_ping_requests_before_first_response},
{StatsReport::kStatsValueNameSentPingResponses, info.sent_ping_responses},
{StatsReport::kStatsValueNameRecvPingRequests, info.recv_ping_requests},
{StatsReport::kStatsValueNameRecvPingResponses, info.recv_ping_responses},
static_cast<int64_t>(info.sent_ping_requests_before_first_response)},
{StatsReport::kStatsValueNameSentPingResponses,
static_cast<int64_t>(info.sent_ping_responses)},
{StatsReport::kStatsValueNameRecvPingRequests,
static_cast<int64_t>(info.recv_ping_requests)},
{StatsReport::kStatsValueNameRecvPingResponses,
static_cast<int64_t>(info.recv_ping_responses)},
};
for (const auto& i : int64s)
report->AddInt64(i.name, i.value);
Expand Down

0 comments on commit 753783a

Please sign in to comment.