From 297fe1a2d95ce1be7414cd0a0082e8fecbab484f Mon Sep 17 00:00:00 2001 From: Dor Hen Date: Wed, 30 Oct 2024 11:44:20 +0200 Subject: [PATCH] [reland] Comment unused variables in implemented functions 10\n Bug: webrtc:370878648 Change-Id: Icbfacf8113942f60ba168e4aa884f0172eaa0fca Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367080 Commit-Queue: Dor Hen Reviewed-by: Danil Chapovalov Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#43336} --- api/peer_connection_interface.h | 17 ++++---- audio/channel_send_unittest.cc | 2 +- call/call_perf_tests.cc | 22 +++++------ .../third_party/SocketRocket/SRWebSocket.m | 14 ++++--- .../events/rtc_event_generic_packet_sent.h | 2 +- .../events/rtc_event_probe_cluster_created.h | 8 ++-- .../events/rtc_event_probe_result_failure.h | 8 ++-- .../events/rtc_event_probe_result_success.h | 8 ++-- .../events/rtc_event_remote_estimate.h | 8 ++-- .../events/rtc_event_route_change.h | 8 ++-- .../rtc_event_video_receive_stream_config.h | 8 ++-- .../rtc_event_video_send_stream_config.h | 8 ++-- logging/rtc_event_log/fake_rtc_event_log.cc | 5 ++- media/base/adapted_video_track_source.h | 6 ++- media/base/media_engine.h | 39 ++++++++++--------- media/base/rtp_utils.cc | 2 +- 16 files changed, 87 insertions(+), 78 deletions(-) diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h index 69144089f9..0108a69347 100644 --- a/api/peer_connection_interface.h +++ b/api/peer_connection_interface.h @@ -1315,22 +1315,22 @@ class PeerConnectionObserver { // See https://w3c.github.io/webrtc-pc/#event-icecandidateerror virtual void OnIceCandidateError(const std::string& /* address */, int /* port */, - const std::string& url, - int error_code, - const std::string& error_text) {} + const std::string& /* url */, + int /* error_code */, + const std::string& /* error_text */) {} // Ice candidates have been removed. // TODO(honghaiz): Make this a pure virtual method when all its subclasses // implement it. virtual void OnIceCandidatesRemoved( - const std::vector& candidates) {} + const std::vector& /* candidates */) {} // Called when the ICE connection receiving status changes. - virtual void OnIceConnectionReceivingChange(bool receiving) {} + virtual void OnIceConnectionReceivingChange(bool /* receiving */) {} // Called when the selected candidate pair for the ICE connection changes. virtual void OnIceSelectedCandidatePairChanged( - const cricket::CandidatePairChangeEvent& event) {} + const cricket::CandidatePairChangeEvent& /* event */) {} // This is called when a receiver and its track are created. // TODO(zhihuang): Make this pure virtual when all subclasses implement it. @@ -1338,8 +1338,9 @@ class PeerConnectionObserver { // Plan users should prefer OnTrack, OnAddTrack is only called as backwards // compatibility (and is called in the exact same situations as OnTrack). virtual void OnAddTrack( - rtc::scoped_refptr receiver, - const std::vector>& streams) {} + rtc::scoped_refptr /* receiver */, + const std::vector< + rtc::scoped_refptr>& /* streams */) {} // This is called when signaling indicates a transceiver will be receiving // media from the remote endpoint. This is fired during a call to diff --git a/audio/channel_send_unittest.cc b/audio/channel_send_unittest.cc index 6c123a2ec6..b415b5fc34 100644 --- a/audio/channel_send_unittest.cc +++ b/audio/channel_send_unittest.cc @@ -235,7 +235,7 @@ TEST_F(ChannelSendTest, AudioLevelsAttachedToCorrectTransformedFrame) { std::vector sent_audio_levels; auto send_rtp = [&](rtc::ArrayView data, - const PacketOptions& options) { + const PacketOptions& /* options */) { RtpPacketReceived packet(&extension_manager); packet.Parse(data); RTPHeader header; diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index dfda906f2d..6ec41fef89 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -746,7 +746,7 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { void OnVideoStreamsCreated(VideoSendStream* send_stream, const std::vector& - receive_streams) override { + /* receive_streams */) override { send_stream_ = send_stream; } @@ -839,9 +839,9 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, } void OnTransportCreated( - test::PacketTransport* to_receiver, + test::PacketTransport* /* to_receiver */, SimulatedNetworkInterface* sender_network, - test::PacketTransport* to_sender, + test::PacketTransport* /* to_sender */, SimulatedNetworkInterface* receiver_network) override { send_simulated_network_ = sender_network; receive_simulated_network_ = receiver_network; @@ -894,7 +894,7 @@ void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from, Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); } - void OnCallsCreated(Call* sender_call, Call* receiver_call) override { + void OnCallsCreated(Call* sender_call, Call* /* receiver_call */) override { sender_call_ = sender_call; BitrateConstraints bitrate_config; bitrate_config.min_bitrate_bps = min_bwe_; @@ -960,8 +960,8 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory, frame_generator_capturer->ChangeResolution(640, 360); } - void OnSinkWantsChanged(rtc::VideoSinkInterface* sink, - const rtc::VideoSinkWants& wants) override {} + void OnSinkWantsChanged(rtc::VideoSinkInterface* /* sink */, + const rtc::VideoSinkWants& /* wants */) override {} void ModifySenderBitrateConfig( BitrateConstraints* bitrate_config) override { @@ -970,7 +970,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory, void OnVideoStreamsCreated(VideoSendStream* send_stream, const std::vector& - receive_streams) override { + /* receive_streams */) override { send_stream_ = send_stream; } @@ -980,7 +980,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory, void ModifyVideoConfigs( VideoSendStream::Config* send_config, - std::vector* receive_configs, + std::vector* /* receive_configs */, VideoEncoderConfig* encoder_config) override { send_config->encoder_settings.encoder_factory = encoder_factory_; send_config->rtp.payload_name = payload_name_; @@ -1021,7 +1021,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory, } } - Action OnSendRtp(rtc::ArrayView packet) override { + Action OnSendRtp(rtc::ArrayView /* packet */) override { const Timestamp now = clock_->CurrentTime(); if (now - last_getstats_time_ > kMinGetStatsInterval) { last_getstats_time_ = now; @@ -1059,7 +1059,7 @@ TEST_F(CallPerfTest, TestEncodeFramerateVp8Simulcast) { InternalEncoderFactory internal_encoder_factory; test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory](const Environment& env, - const SdpVideoFormat& format) { + const SdpVideoFormat& /* format */) { return std::make_unique( env, &internal_encoder_factory, nullptr, SdpVideoFormat::VP8()); }); @@ -1072,7 +1072,7 @@ TEST_F(CallPerfTest, TestEncodeFramerateVp8SimulcastLowerInputFps) { InternalEncoderFactory internal_encoder_factory; test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory](const Environment& env, - const SdpVideoFormat& format) { + const SdpVideoFormat& /* format */) { return std::make_unique( env, &internal_encoder_factory, nullptr, SdpVideoFormat::VP8()); }); diff --git a/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m b/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m index ab0d1b89bc..7c1dd98a81 100644 --- a/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m +++ b/examples/objc/AppRTCMobile/third_party/SocketRocket/SRWebSocket.m @@ -527,9 +527,11 @@ static __strong NSData *CRLFCRLF; CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Protocol"), (__bridge CFStringRef)[_requestedProtocols componentsJoinedByString:@", "]); } - [_urlRequest.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { - CFHTTPMessageSetHeaderFieldValue(request, (__bridge CFStringRef)key, (__bridge CFStringRef)obj); - }]; + [_urlRequest.allHTTPHeaderFields + enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop __unused) { + CFHTTPMessageSetHeaderFieldValue( + request, (__bridge CFStringRef)key, (__bridge CFStringRef)obj); + }]; NSData *message = CFBridgingRelease(CFHTTPMessageCopySerializedMessage(request)); @@ -1627,7 +1629,7 @@ static const size_t SRFrameHeaderOverhead = 32; //#define SR_ENABLE_LOG -static inline void SRFastLog(NSString *format, ...) { +static inline void SRFastLog(NSString *format, ...) { #ifdef SR_ENABLE_LOG __block va_list arg_list; va_start (arg_list, format); @@ -1637,10 +1639,12 @@ static inline void SRFastLog(NSString *format, ...) { va_end(arg_list); NSLog(@"[SR] %@", formattedString); +#else + // Cannot use [[maybe_unused]] here since this file might compile with GCC in objc context. + (void)format; #endif } - #ifdef HAS_ICU static inline int32_t validate_dispatch_data_partial_string(NSData *data) { diff --git a/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h b/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h index 031002c2c9..15ad3395c6 100644 --- a/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h +++ b/logging/rtc_event_log/events/rtc_event_generic_packet_sent.h @@ -94,7 +94,7 @@ class RtcEventGenericPacketSent final : public RtcEvent { static RtcEventLogParseStatus Parse( absl::string_view /* encoded_bytes */, bool /* batched */, - std::vector& output) { + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h index b927f1e52d..fed8b3cfc1 100644 --- a/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h +++ b/logging/rtc_event_log/events/rtc_event_probe_cluster_created.h @@ -69,15 +69,15 @@ class RtcEventProbeClusterCreated final : public RtcEvent { uint32_t min_probes() const { return min_probes_; } uint32_t min_bytes() const { return min_bytes_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h index ca57d08481..cd63b735b3 100644 --- a/logging/rtc_event_log/events/rtc_event_probe_result_failure.h +++ b/logging/rtc_event_log/events/rtc_event_probe_result_failure.h @@ -63,15 +63,15 @@ class RtcEventProbeResultFailure final : public RtcEvent { int32_t id() const { return id_; } ProbeFailureReason failure_reason() const { return failure_reason_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_probe_result_success.h b/logging/rtc_event_log/events/rtc_event_probe_result_success.h index 60f9023dc5..44dc218861 100644 --- a/logging/rtc_event_log/events/rtc_event_probe_result_success.h +++ b/logging/rtc_event_log/events/rtc_event_probe_result_success.h @@ -56,15 +56,15 @@ class RtcEventProbeResultSuccess final : public RtcEvent { int32_t id() const { return id_; } int32_t bitrate_bps() const { return bitrate_bps_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_remote_estimate.h b/logging/rtc_event_log/events/rtc_event_remote_estimate.h index d01abe726d..73333c7d47 100644 --- a/logging/rtc_event_log/events/rtc_event_remote_estimate.h +++ b/logging/rtc_event_log/events/rtc_event_remote_estimate.h @@ -48,15 +48,15 @@ class RtcEventRemoteEstimate final : public RtcEvent { Type GetType() const override { return kType; } bool IsConfigEvent() const override { return false; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_route_change.h b/logging/rtc_event_log/events/rtc_event_route_change.h index 5ff2b29475..0001aa6f3d 100644 --- a/logging/rtc_event_log/events/rtc_event_route_change.h +++ b/logging/rtc_event_log/events/rtc_event_route_change.h @@ -53,15 +53,15 @@ class RtcEventRouteChange final : public RtcEvent { bool connected() const { return connected_; } uint32_t overhead() const { return overhead_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h index d506fc76f2..b05e30b53d 100644 --- a/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h +++ b/logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h @@ -53,15 +53,15 @@ class RtcEventVideoReceiveStreamConfig final : public RtcEvent { const rtclog::StreamConfig& config() const { return *config_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h index f007055600..baca0ee048 100644 --- a/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h +++ b/logging/rtc_event_log/events/rtc_event_video_send_stream_config.h @@ -53,15 +53,15 @@ class RtcEventVideoSendStreamConfig final : public RtcEvent { const rtclog::StreamConfig& config() const { return *config_; } - static std::string Encode(rtc::ArrayView batch) { + static std::string Encode(rtc::ArrayView /* batch */) { // TODO(terelius): Implement return ""; } static RtcEventLogParseStatus Parse( - absl::string_view encoded_bytes, - bool batched, - std::vector& output) { + absl::string_view /* encoded_bytes */, + bool /* batched */, + std::vector& /* output */) { // TODO(terelius): Implement return RtcEventLogParseStatus::Error("Not Implemented", __FILE__, __LINE__); } diff --git a/logging/rtc_event_log/fake_rtc_event_log.cc b/logging/rtc_event_log/fake_rtc_event_log.cc index 836492fa9b..ca6b1c4242 100644 --- a/logging/rtc_event_log/fake_rtc_event_log.cc +++ b/logging/rtc_event_log/fake_rtc_event_log.cc @@ -20,8 +20,9 @@ namespace webrtc { -bool FakeRtcEventLog::StartLogging(std::unique_ptr output, - int64_t output_period_ms) { +bool FakeRtcEventLog::StartLogging( + std::unique_ptr /* output */, + int64_t /* output_period_ms */) { return true; } diff --git a/media/base/adapted_video_track_source.h b/media/base/adapted_video_track_source.h index 670331dbe3..6bf90862f3 100644 --- a/media/base/adapted_video_track_source.h +++ b/media/base/adapted_video_track_source.h @@ -86,9 +86,11 @@ class RTC_EXPORT AdaptedVideoTrackSource bool SupportsEncodedOutput() const override { return false; } void GenerateKeyFrame() override {} void AddEncodedSink( - rtc::VideoSinkInterface* sink) override {} + rtc::VideoSinkInterface* /* sink */) + override {} void RemoveEncodedSink( - rtc::VideoSinkInterface* sink) override {} + rtc::VideoSinkInterface* /* sink */) + override {} void ProcessConstraints( const webrtc::VideoTrackSourceConstraints& constraints) override; diff --git a/media/base/media_engine.h b/media/base/media_engine.h index 780bac0022..ea89116cf6 100644 --- a/media/base/media_engine.h +++ b/media/base/media_engine.h @@ -105,22 +105,22 @@ class VoiceEngineInterface : public RtpHeaderExtensionQueryInterface { virtual rtc::scoped_refptr GetAudioState() const = 0; virtual std::unique_ptr CreateSendChannel( - webrtc::Call* call, - const MediaConfig& config, - const AudioOptions& options, - const webrtc::CryptoOptions& crypto_options, - webrtc::AudioCodecPairId codec_pair_id) { + webrtc::Call* /* call */, + const MediaConfig& /* config */, + const AudioOptions& /* options */, + const webrtc::CryptoOptions& /* crypto_options */, + webrtc::AudioCodecPairId /* codec_pair_id */) { // TODO(hta): Make pure virtual when all downstream has updated RTC_CHECK_NOTREACHED(); return nullptr; } virtual std::unique_ptr - CreateReceiveChannel(webrtc::Call* call, - const MediaConfig& config, - const AudioOptions& options, - const webrtc::CryptoOptions& crypto_options, - webrtc::AudioCodecPairId codec_pair_id) { + CreateReceiveChannel(webrtc::Call* /* call */, + const MediaConfig& /* config */, + const AudioOptions& /* options */, + const webrtc::CryptoOptions& /* crypto_options */, + webrtc::AudioCodecPairId /* codec_pair_id */) { // TODO(hta): Make pure virtual when all downstream has updated RTC_CHECK_NOTREACHED(); return nullptr; @@ -155,21 +155,22 @@ class VideoEngineInterface : public RtpHeaderExtensionQueryInterface { VideoEngineInterface& operator=(const VideoEngineInterface&) = delete; virtual std::unique_ptr CreateSendChannel( - webrtc::Call* call, - const MediaConfig& config, - const VideoOptions& options, - const webrtc::CryptoOptions& crypto_options, - webrtc::VideoBitrateAllocatorFactory* video_bitrate_allocator_factory) { + webrtc::Call* /* call */, + const MediaConfig& /* config */, + const VideoOptions& /* options */, + const webrtc::CryptoOptions& /* crypto_options */, + webrtc:: + VideoBitrateAllocatorFactory* /* video_bitrate_allocator_factory */) { // Default implementation, delete when all is updated RTC_CHECK_NOTREACHED(); return nullptr; } virtual std::unique_ptr - CreateReceiveChannel(webrtc::Call* call, - const MediaConfig& config, - const VideoOptions& options, - const webrtc::CryptoOptions& crypto_options) { + CreateReceiveChannel(webrtc::Call* /* call */, + const MediaConfig& /* config */, + const VideoOptions& /* options */, + const webrtc::CryptoOptions& /* crypto_options */) { // Default implementation, delete when all is updated RTC_CHECK_NOTREACHED(); return nullptr; diff --git a/media/base/rtp_utils.cc b/media/base/rtp_utils.cc index 9546ed6e30..bbfead5d03 100644 --- a/media/base/rtp_utils.cc +++ b/media/base/rtp_utils.cc @@ -238,7 +238,7 @@ bool ValidateRtpHeader(const uint8_t* rtp, // ValidateRtpHeader() must be called before this method to make sure, we have // a sane rtp packet. bool UpdateRtpAbsSendTimeExtension(uint8_t* rtp, - size_t length, + size_t /* length */, int extension_id, uint64_t time_us) { // 0 1 2 3