| 1 | From c8896801dfbfe03b56f85c1533abc077ff74a533 Mon Sep 17 00:00:00 2001
|
| 2 | From: Reilly Brogan <[email protected]>
|
| 3 | Date: Tue, 19 Aug 2025 14:47:03 -0500
|
| 4 | Subject: [PATCH 1/2] Fix build with abseil-cpp 202508
|
| 5 |
|
| 6 | ---
|
| 7 | webrtc/api/audio/audio_processing.h | 12 +++++++++
|
| 8 | webrtc/api/make_ref_counted.h | 13 ++++++++++
|
| 9 | webrtc/api/scoped_refptr.h | 15 +++++++++++
|
| 10 | .../aec_dump/aec_dump_factory.h | 15 +++++++++++
|
| 11 | .../aec_dump/null_aec_dump_factory.cc | 25 +++++++++++++++++++
|
| 12 | .../audio_processing/audio_processing_impl.cc | 9 +++++++
|
| 13 | .../audio_processing/audio_processing_impl.h | 9 +++++++
|
| 14 | 7 files changed, 98 insertions(+)
|
| 15 |
|
| 16 | diff --git a/webrtc/api/audio/audio_processing.h b/webrtc/api/audio/audio_processing.h
|
| 17 | index dca75f2..4580ba9 100644
|
| 18 | |
| 19 | |
| 20 | @@ -28,6 +28,7 @@
|
| 21 | #include <string>
|
| 22 | #include <utility>
|
| 23 |
|
| 24 | +#include "absl/base/config.h"
|
| 25 | #include "absl/base/nullability.h"
|
| 26 | #include "absl/strings/string_view.h"
|
| 27 | #include "api/array_view.h"
|
| 28 | @@ -632,6 +633,7 @@ class RTC_EXPORT AudioProcessing : public RefCountInterface {
|
| 29 | // return value of true indicates that the file has been
|
| 30 | // sucessfully opened, while a value of false indicates that
|
| 31 | // opening the file failed.
|
| 32 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 33 | virtual bool CreateAndAttachAecDump(
|
| 34 | absl::string_view file_name,
|
| 35 | int64_t max_log_size_bytes,
|
| 36 | @@ -640,6 +642,16 @@ class RTC_EXPORT AudioProcessing : public RefCountInterface {
|
| 37 | absl::Nonnull<FILE*> handle,
|
| 38 | int64_t max_log_size_bytes,
|
| 39 | absl::Nonnull<TaskQueueBase*> worker_queue) = 0;
|
| 40 | +#else
|
| 41 | + virtual bool CreateAndAttachAecDump(absl::string_view file_name,
|
| 42 | + int64_t max_log_size_bytes,
|
| 43 | + TaskQueueBase* absl_nonnull
|
| 44 | + worker_queue) = 0;
|
| 45 | + virtual bool CreateAndAttachAecDump(FILE* absl_nonnull handle,
|
| 46 | + int64_t max_log_size_bytes,
|
| 47 | + TaskQueueBase* absl_nonnull
|
| 48 | + worker_queue) = 0;
|
| 49 | +#endif
|
| 50 |
|
| 51 | // TODO(webrtc:5298) Deprecated variant.
|
| 52 | // Attaches provided webrtc::AecDump for recording debugging
|
| 53 | diff --git a/webrtc/api/make_ref_counted.h b/webrtc/api/make_ref_counted.h
|
| 54 | index b5f4e99..080023a 100644
|
| 55 | |
| 56 | |
| 57 | @@ -13,6 +13,7 @@
|
| 58 | #include <type_traits>
|
| 59 | #include <utility>
|
| 60 |
|
| 61 | +#include "absl/base/config.h"
|
| 62 | #include "absl/base/nullability.h"
|
| 63 | #include "api/ref_count.h"
|
| 64 | #include "api/scoped_refptr.h"
|
| 65 | @@ -86,7 +87,11 @@ template <
|
| 66 | typename std::enable_if<std::is_convertible_v<T*, RefCountInterface*> &&
|
| 67 | std::is_abstract_v<T>,
|
| 68 | T>::type* = nullptr>
|
| 69 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 70 | absl::Nonnull<scoped_refptr<T>> make_ref_counted(Args&&... args) {
|
| 71 | +#else
|
| 72 | +absl_nonnull scoped_refptr<T> make_ref_counted(Args&&... args) {
|
| 73 | +#endif
|
| 74 | return scoped_refptr<T>(new RefCountedObject<T>(std::forward<Args>(args)...));
|
| 75 | }
|
| 76 |
|
| 77 | @@ -99,7 +104,11 @@ template <
|
| 78 | !std::is_convertible_v<T*, RefCountInterface*> &&
|
| 79 | webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value,
|
| 80 | T>::type* = nullptr>
|
| 81 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 82 | absl::Nonnull<scoped_refptr<T>> make_ref_counted(Args&&... args) {
|
| 83 | +#else
|
| 84 | +absl_nonnull scoped_refptr<T> make_ref_counted(Args&&... args) {
|
| 85 | +#endif
|
| 86 | return scoped_refptr<T>(new T(std::forward<Args>(args)...));
|
| 87 | }
|
| 88 |
|
| 89 | @@ -113,7 +122,11 @@ template <
|
| 90 | !webrtc_make_ref_counted_internal::HasAddRefAndRelease<T>::value,
|
| 91 |
|
| 92 | T>::type* = nullptr>
|
| 93 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 94 | absl::Nonnull<scoped_refptr<FinalRefCountedObject<T>>> make_ref_counted(
|
| 95 | +#else
|
| 96 | +absl_nonnull scoped_refptr<FinalRefCountedObject<T>> make_ref_counted(
|
| 97 | +#endif
|
| 98 | Args&&... args) {
|
| 99 | return scoped_refptr<FinalRefCountedObject<T>>(
|
| 100 | new FinalRefCountedObject<T>(std::forward<Args>(args)...));
|
| 101 | diff --git a/webrtc/api/scoped_refptr.h b/webrtc/api/scoped_refptr.h
|
| 102 | index c6fb560..8c441ff 100644
|
| 103 | |
| 104 | |
| 105 | @@ -66,6 +66,7 @@
|
| 106 | #include <cstddef>
|
| 107 | #include <utility>
|
| 108 |
|
| 109 | +#include "absl/base/config.h"
|
| 110 | #include "absl/base/nullability.h"
|
| 111 |
|
| 112 | namespace webrtc {
|
| 113 | @@ -73,13 +74,19 @@ namespace webrtc {
|
| 114 | template <class T>
|
| 115 | class ABSL_NULLABILITY_COMPATIBLE scoped_refptr {
|
| 116 | public:
|
| 117 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 118 | using absl_nullability_compatible = void;
|
| 119 | +#endif
|
| 120 | using element_type = T;
|
| 121 |
|
| 122 | scoped_refptr() : ptr_(nullptr) {}
|
| 123 | scoped_refptr(std::nullptr_t) : ptr_(nullptr) {} // NOLINT(runtime/explicit)
|
| 124 |
|
| 125 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 126 | explicit scoped_refptr(absl::Nullable<T*> p) : ptr_(p) {
|
| 127 | +#else
|
| 128 | + explicit scoped_refptr(T* absl_nullable p) : ptr_(p) {
|
| 129 | +#endif
|
| 130 | if (ptr_)
|
| 131 | ptr_->AddRef();
|
| 132 | }
|
| 133 | @@ -122,7 +129,11 @@ class ABSL_NULLABILITY_COMPATIBLE scoped_refptr {
|
| 134 | return retVal;
|
| 135 | }
|
| 136 |
|
| 137 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 138 | scoped_refptr<T>& operator=(absl::Nullable<T*> p) {
|
| 139 | +#else
|
| 140 | + scoped_refptr<T>& operator=(T* absl_nullable p) {
|
| 141 | +#endif
|
| 142 | // AddRef first so that self assignment should work
|
| 143 | if (p)
|
| 144 | p->AddRef();
|
| 145 | @@ -152,7 +163,11 @@ class ABSL_NULLABILITY_COMPATIBLE scoped_refptr {
|
| 146 | return *this;
|
| 147 | }
|
| 148 |
|
| 149 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 150 | void swap(absl::Nonnull<T**> pp) noexcept {
|
| 151 | +#else
|
| 152 | + void swap(T** absl_nonnull pp) noexcept {
|
| 153 | +#endif
|
| 154 | T* p = ptr_;
|
| 155 | ptr_ = *pp;
|
| 156 | *pp = p;
|
| 157 | diff --git a/webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h b/webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h
|
| 158 | index 0d258a9..14d8b39 100644
|
| 159 | |
| 160 | |
| 161 | @@ -29,6 +29,7 @@ class RTC_EXPORT AecDumpFactory {
|
| 162 | // The AecDump takes responsibility for `handle` and closes it in the
|
| 163 | // destructor. A non-null return value indicates that the file has been
|
| 164 | // sucessfully opened.
|
| 165 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 166 | static absl::Nullable<std::unique_ptr<AecDump>> Create(
|
| 167 | FileWrapper file,
|
| 168 | int64_t max_log_size_bytes,
|
| 169 | @@ -41,6 +42,20 @@ class RTC_EXPORT AecDumpFactory {
|
| 170 | absl::Nonnull<FILE*> handle,
|
| 171 | int64_t max_log_size_bytes,
|
| 172 | absl::Nonnull<TaskQueueBase*> worker_queue);
|
| 173 | +#else
|
| 174 | + static absl_nullable std::unique_ptr<AecDump> Create(
|
| 175 | + FileWrapper file,
|
| 176 | + int64_t max_log_size_bytes,
|
| 177 | + TaskQueueBase* absl_nonnull worker_queue);
|
| 178 | + static absl_nullable std::unique_ptr<AecDump> Create(
|
| 179 | + absl::string_view file_name,
|
| 180 | + int64_t max_log_size_bytes,
|
| 181 | + TaskQueueBase* absl_nonnull worker_queue);
|
| 182 | + static absl_nullable std::unique_ptr<AecDump> Create(
|
| 183 | + FILE* absl_nonnull handle,
|
| 184 | + int64_t max_log_size_bytes,
|
| 185 | + TaskQueueBase* absl_nonnull worker_queue);
|
| 186 | +#endif
|
| 187 | };
|
| 188 |
|
| 189 | } // namespace webrtc
|
| 190 | diff --git a/webrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc b/webrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc
|
| 191 | index 63929af..658bcee 100644
|
| 192 | |
| 193 | |
| 194 | @@ -16,6 +16,7 @@
|
| 195 |
|
| 196 | namespace webrtc {
|
| 197 |
|
| 198 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 199 | absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create(
|
| 200 | FileWrapper file,
|
| 201 | int64_t max_log_size_bytes,
|
| 202 | @@ -37,3 +38,27 @@ absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create(
|
| 203 | return nullptr;
|
| 204 | }
|
| 205 | } // namespace webrtc
|
| 206 | +#else
|
| 207 | +absl_nullable std::unique_ptr<AecDump> AecDumpFactory::Create(
|
| 208 | + FileWrapper file,
|
| 209 | + int64_t max_log_size_bytes,
|
| 210 | + TaskQueueBase* absl_nonnull worker_queue) {
|
| 211 | + return nullptr;
|
| 212 | +}
|
| 213 | +
|
| 214 | +absl_nullable std::unique_ptr<AecDump> AecDumpFactory::Create(
|
| 215 | + absl::string_view file_name,
|
| 216 | + int64_t max_log_size_bytes,
|
| 217 | + TaskQueueBase* absl_nonnull worker_queue) {
|
| 218 | + return nullptr;
|
| 219 | +}
|
| 220 | +
|
| 221 | +absl_nullable std::unique_ptr<AecDump> AecDumpFactory::Create(
|
| 222 | + FILE* absl_nonnull handle,
|
| 223 | + int64_t max_log_size_bytes,
|
| 224 | + TaskQueueBase* absl_nonnull worker_queue) {
|
| 225 | + return nullptr;
|
| 226 | +}
|
| 227 | +} // namespace webrtc
|
| 228 | +
|
| 229 | +#endif
|
| 230 | diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
|
| 231 | index a1cba51..1dfe26d 100644
|
| 232 | |
| 233 | |
| 234 | @@ -19,6 +19,7 @@
|
| 235 | #include <type_traits>
|
| 236 | #include <utility>
|
| 237 |
|
| 238 | +#include "absl/base/config.h"
|
| 239 | #include "absl/base/nullability.h"
|
| 240 | #include "absl/strings/match.h"
|
| 241 | #include "absl/strings/string_view.h"
|
| 242 | @@ -1787,7 +1788,11 @@ void AudioProcessingImpl::UpdateRecommendedInputVolumeLocked() {
|
| 243 | bool AudioProcessingImpl::CreateAndAttachAecDump(
|
| 244 | absl::string_view file_name,
|
| 245 | int64_t max_log_size_bytes,
|
| 246 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 247 | absl::Nonnull<TaskQueueBase*> worker_queue) {
|
| 248 | +#else
|
| 249 | + TaskQueueBase* absl_nonnull worker_queue) {
|
| 250 | +#endif
|
| 251 | std::unique_ptr<AecDump> aec_dump =
|
| 252 | AecDumpFactory::Create(file_name, max_log_size_bytes, worker_queue);
|
| 253 | if (!aec_dump) {
|
| 254 | @@ -1801,7 +1806,11 @@ bool AudioProcessingImpl::CreateAndAttachAecDump(
|
| 255 | bool AudioProcessingImpl::CreateAndAttachAecDump(
|
| 256 | FILE* handle,
|
| 257 | int64_t max_log_size_bytes,
|
| 258 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 259 | absl::Nonnull<TaskQueueBase*> worker_queue) {
|
| 260 | +#else
|
| 261 | + TaskQueueBase* absl_nonnull worker_queue) {
|
| 262 | +#endif
|
| 263 | std::unique_ptr<AecDump> aec_dump =
|
| 264 | AecDumpFactory::Create(handle, max_log_size_bytes, worker_queue);
|
| 265 | if (!aec_dump) {
|
| 266 | diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h
|
| 267 | index ecdc055..51a2bfb 100644
|
| 268 | |
| 269 | |
| 270 | @@ -20,6 +20,7 @@
|
| 271 | #include <string>
|
| 272 | #include <vector>
|
| 273 |
|
| 274 | +#include "absl/base/config.h"
|
| 275 | #include "absl/base/nullability.h"
|
| 276 | #include "absl/strings/string_view.h"
|
| 277 | #include "api/array_view.h"
|
| 278 | @@ -74,11 +75,19 @@ class AudioProcessingImpl : public AudioProcessing {
|
| 279 | bool CreateAndAttachAecDump(
|
| 280 | absl::string_view file_name,
|
| 281 | int64_t max_log_size_bytes,
|
| 282 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 283 | absl::Nonnull<TaskQueueBase*> worker_queue) override;
|
| 284 | +#else
|
| 285 | + TaskQueueBase* absl_nonnull worker_queue) override;
|
| 286 | +#endif
|
| 287 | bool CreateAndAttachAecDump(
|
| 288 | FILE* handle,
|
| 289 | int64_t max_log_size_bytes,
|
| 290 | +#if defined(ABSL_LTS_RELEASE_VERSION) && ABSL_LTS_RELEASE_VERSION < 20250512
|
| 291 | absl::Nonnull<TaskQueueBase*> worker_queue) override;
|
| 292 | +#else
|
| 293 | + TaskQueueBase* absl_nonnull worker_queue) override;
|
| 294 | +#endif
|
| 295 | // TODO(webrtc:5298) Deprecated variant.
|
| 296 | void AttachAecDump(std::unique_ptr<AecDump> aec_dump) override;
|
| 297 | void DetachAecDump() override;
|
| 298 | --
|
| 299 | GitLab
|