Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devel/electron28: fix build with clang 18
Clang 18 has become more stringent about narrowing in initializer lists, resulting in errors when building devel/electron28: ../../third_party/webrtc/pc/legacy_stats_collector.cc:191:54: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing-const-reference] 191 | {StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy}, | ^~~~~~~~~~~~~~~~~~~~~~~~ ../../third_party/webrtc/pc/legacy_stats_collector.cc:193:8: error: non-constant-expression cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing-const-reference] 193 | info.total_output_duration}}; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ and later: In file included from ../../cc/layers/mirror_layer_impl.cc:5: ../../cc/layers/mirror_layer_impl.h:59:40: error: non-constant-expression cannot be narrowed from type 'int' to 'unsigned long' in initializer list [-Wc++11-narrowing-const-reference] 59 | return viz::CompositorRenderPassId{mirrored_layer_id()}; | ^~~~~~~~~~~~~~~~~~~ The first batch of errors can be fixed similarly to bug 276997, by cherry-picking <https://webrtc.googlesource.com/src/+/267f9bdd53> into the thirdparty directory. The second batch of errors can be fixed by cherry-picking <https://chromium.googlesource.com/chromium/src/+/5e9fb4130a537>. PR: 277129
- Loading branch information
1 parent
d5ded9f
commit 4c36b9d
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
devel/electron28/files/patch-cc_layers_mirror__layer__impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- cc/layers/mirror_layer_impl.h.orig 2024-02-15 09:02:43 UTC | ||
+++ cc/layers/mirror_layer_impl.h | ||
@@ -5,6 +5,7 @@ | ||
#ifndef CC_LAYERS_MIRROR_LAYER_IMPL_H_ | ||
#define CC_LAYERS_MIRROR_LAYER_IMPL_H_ | ||
|
||
+#include <cstdint> | ||
#include <memory> | ||
|
||
#include "base/memory/ptr_util.h" | ||
@@ -56,7 +57,8 @@ class CC_EXPORT MirrorLayerImpl : public LayerImpl { | ||
private: | ||
const char* LayerTypeAsString() const override; | ||
viz::CompositorRenderPassId mirrored_layer_render_pass_id() const { | ||
- return viz::CompositorRenderPassId{mirrored_layer_id()}; | ||
+ return viz::CompositorRenderPassId{ | ||
+ static_cast<uint64_t>(mirrored_layer_id())}; | ||
} | ||
|
||
int mirrored_layer_id_ = 0; |
14 changes: 14 additions & 0 deletions
14
devel/electron28/files/patch-components_power__metrics_energy__metrics__provider__linux.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- components/power_metrics/energy_metrics_provider_linux.cc.orig 2024-02-15 09:02:48 UTC | ||
+++ components/power_metrics/energy_metrics_provider_linux.cc | ||
@@ -61,9 +61,9 @@ base::ScopedFD OpenPerfEvent(perf_event_attr* perf_att | ||
// value of less than 1. Here, we only consider cpu0. See details in | ||
// https://man7.org/linux/man-pages/man2/perf_event_open.2.html. | ||
base::ScopedFD OpenPerfEvent(perf_event_attr* perf_attr) { | ||
- base::ScopedFD perf_fd{syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1, | ||
+ base::ScopedFD perf_fd(syscall(__NR_perf_event_open, perf_attr, /*pid=*/-1, | ||
/*cpu=*/0, /*group_fd=*/-1, | ||
- PERF_FLAG_FD_CLOEXEC)}; | ||
+ static_cast<int>(PERF_FLAG_FD_CLOEXEC))); | ||
return perf_fd; | ||
} | ||
|
98 changes: 98 additions & 0 deletions
98
devel/electron28/files/patch-third__party_webrtc_pc_legacy__stats__collector.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- third_party/webrtc/pc/legacy_stats_collector.cc.orig 2024-02-15 09:10:29 UTC | ||
+++ third_party/webrtc/pc/legacy_stats_collector.cc | ||
@@ -188,9 +188,10 @@ void ExtractStats(const cricket::VoiceReceiverInfo& in | ||
{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}, | ||
@@ -244,9 +245,10 @@ 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[] = { | ||
@@ -340,7 +342,8 @@ void ExtractStats(const cricket::VideoReceiverInfo& in | ||
{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) | ||
@@ -384,15 +387,19 @@ 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) | ||
@@ -780,19 +787,25 @@ StatsReport* LegacyStatsCollector::AddConnectionInfoRe | ||
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); |