diff options
Diffstat (limited to '')
6 files changed, 66 insertions, 47 deletions
diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/BUILD.gn b/third_party/libwebrtc/modules/audio_processing/aec_dump/BUILD.gn index 78bae56835..5193e28dff 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/BUILD.gn +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/BUILD.gn @@ -14,10 +14,14 @@ rtc_source_set("aec_dump") { deps = [ "..:aec_dump_interface", + "../../../api/task_queue", "../../../rtc_base/system:file_wrapper", "../../../rtc_base/system:rtc_export", ] - absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] + absl_deps = [ + "//third_party/abseil-cpp/absl/base:nullability", + "//third_party/abseil-cpp/absl/strings", + ] } if (rtc_include_tests) { @@ -71,11 +75,13 @@ if (rtc_enable_protobuf) { "../../../rtc_base:protobuf_utils", "../../../rtc_base:race_checker", "../../../rtc_base:rtc_event", - "../../../rtc_base:rtc_task_queue", "../../../rtc_base/system:file_wrapper", "../../../system_wrappers", ] - absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] + absl_deps = [ + "//third_party/abseil-cpp/absl/base:nullability", + "//third_party/abseil-cpp/absl/strings", + ] deps += [ "../:audioproc_debug_proto" ] } @@ -106,6 +112,10 @@ rtc_library("null_aec_dump_factory") { deps = [ ":aec_dump", "..:aec_dump_interface", + "../../../api/task_queue", + ] + absl_deps = [ + "//third_party/abseil-cpp/absl/base:nullability", + "//third_party/abseil-cpp/absl/strings", ] - absl_deps = [ "//third_party/abseil-cpp/absl/strings" ] } diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_factory.h b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_factory.h index 20718c3d7f..0d258a9ebc 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_factory.h +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_factory.h @@ -13,34 +13,34 @@ #include <memory> +#include "absl/base/nullability.h" #include "absl/strings/string_view.h" +#include "api/task_queue/task_queue_base.h" #include "modules/audio_processing/include/aec_dump.h" #include "rtc_base/system/file_wrapper.h" #include "rtc_base/system/rtc_export.h" -namespace rtc { -class TaskQueue; -} // namespace rtc - namespace webrtc { class RTC_EXPORT AecDumpFactory { public: - // The `worker_queue` may not be null and must outlive the created - // AecDump instance. `max_log_size_bytes == -1` means the log size - // will be unlimited. `handle` may not be null. The AecDump takes - // responsibility for `handle` and closes it in the destructor. A - // non-null return value indicates that the file has been + // The `worker_queue` must outlive the created AecDump instance. + // `max_log_size_bytes == -1` means the log size will be unlimited. + // The AecDump takes responsibility for `handle` and closes it in the + // destructor. A non-null return value indicates that the file has been // sucessfully opened. - static std::unique_ptr<AecDump> Create(webrtc::FileWrapper file, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue); - static std::unique_ptr<AecDump> Create(absl::string_view file_name, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue); - static std::unique_ptr<AecDump> Create(FILE* handle, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue); + static absl::Nullable<std::unique_ptr<AecDump>> Create( + FileWrapper file, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue); + static absl::Nullable<std::unique_ptr<AecDump>> Create( + absl::string_view file_name, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue); + static absl::Nullable<std::unique_ptr<AecDump>> Create( + absl::Nonnull<FILE*> handle, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue); }; } // namespace webrtc diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.cc b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.cc index 94c24048e0..8484fcc6e1 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.cc +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.cc @@ -13,11 +13,12 @@ #include <memory> #include <utility> +#include "absl/base/nullability.h" #include "absl/strings/string_view.h" +#include "api/task_queue/task_queue_base.h" #include "modules/audio_processing/aec_dump/aec_dump_factory.h" #include "rtc_base/checks.h" #include "rtc_base/event.h" -#include "rtc_base/task_queue.h" namespace webrtc { @@ -59,7 +60,7 @@ void CopyFromConfigToEvent(const webrtc::InternalAPMConfig& config, AecDumpImpl::AecDumpImpl(FileWrapper debug_file, int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) + absl::Nonnull<TaskQueueBase*> worker_queue) : debug_file_(std::move(debug_file)), num_bytes_left_for_log_(max_log_size_bytes), worker_queue_(worker_queue) {} @@ -254,9 +255,10 @@ void AecDumpImpl::PostWriteToFileTask(std::unique_ptr<audioproc::Event> event) { }); } -std::unique_ptr<AecDump> AecDumpFactory::Create(webrtc::FileWrapper file, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + FileWrapper file, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { RTC_DCHECK(worker_queue); if (!file.is_open()) return nullptr; @@ -265,16 +267,18 @@ std::unique_ptr<AecDump> AecDumpFactory::Create(webrtc::FileWrapper file, worker_queue); } -std::unique_ptr<AecDump> AecDumpFactory::Create(absl::string_view file_name, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + absl::string_view file_name, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { return Create(FileWrapper::OpenWriteOnly(file_name), max_log_size_bytes, worker_queue); } -std::unique_ptr<AecDump> AecDumpFactory::Create(FILE* handle, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + absl::Nonnull<FILE*> handle, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { return Create(FileWrapper(handle), max_log_size_bytes, worker_queue); } diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.h b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.h index 429808f9af..d5af31b01e 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.h +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_impl.h @@ -15,11 +15,11 @@ #include <string> #include <vector> +#include "api/task_queue/task_queue_base.h" #include "modules/audio_processing/aec_dump/capture_stream_info.h" #include "modules/audio_processing/include/aec_dump.h" #include "rtc_base/race_checker.h" #include "rtc_base/system/file_wrapper.h" -#include "rtc_base/task_queue.h" #include "rtc_base/thread_annotations.h" // Files generated at build-time by the protobuf compiler. @@ -39,7 +39,7 @@ class AecDumpImpl : public AecDump { // `max_log_size_bytes == -1` means the log size will be unlimited. AecDumpImpl(FileWrapper debug_file, int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue); + absl::Nonnull<TaskQueueBase*> worker_queue); AecDumpImpl(const AecDumpImpl&) = delete; AecDumpImpl& operator=(const AecDumpImpl&) = delete; ~AecDumpImpl() override; @@ -74,7 +74,7 @@ class AecDumpImpl : public AecDump { FileWrapper debug_file_; int64_t num_bytes_left_for_log_ = 0; rtc::RaceChecker race_checker_; - rtc::TaskQueue* worker_queue_; + absl::Nonnull<TaskQueueBase*> worker_queue_; CaptureStreamInfo capture_stream_info_; }; } // namespace webrtc diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_unittest.cc b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_unittest.cc index 62f896fe14..2a8110c4fc 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_unittest.cc +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_unittest.cc @@ -28,7 +28,7 @@ TEST(AecDumper, APICallsDoNotCrash) { { std::unique_ptr<webrtc::AecDump> aec_dump = - webrtc::AecDumpFactory::Create(filename, -1, &file_writer_queue); + webrtc::AecDumpFactory::Create(filename, -1, file_writer_queue.Get()); constexpr int kNumChannels = 1; constexpr int kNumSamplesPerChannel = 160; @@ -63,7 +63,7 @@ TEST(AecDumper, WriteToFile) { { std::unique_ptr<webrtc::AecDump> aec_dump = - webrtc::AecDumpFactory::Create(filename, -1, &file_writer_queue); + webrtc::AecDumpFactory::Create(filename, -1, file_writer_queue.Get()); constexpr int kNumChannels = 1; constexpr int kNumSamplesPerChannel = 160; diff --git a/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc b/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc index 9bd9745069..63929afac4 100644 --- a/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc +++ b/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory.cc @@ -8,27 +8,32 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "absl/base/nullability.h" #include "absl/strings/string_view.h" +#include "api/task_queue/task_queue_base.h" #include "modules/audio_processing/aec_dump/aec_dump_factory.h" #include "modules/audio_processing/include/aec_dump.h" namespace webrtc { -std::unique_ptr<AecDump> AecDumpFactory::Create(webrtc::FileWrapper file, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + FileWrapper file, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { return nullptr; } -std::unique_ptr<AecDump> AecDumpFactory::Create(absl::string_view file_name, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + absl::string_view file_name, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { return nullptr; } -std::unique_ptr<AecDump> AecDumpFactory::Create(FILE* handle, - int64_t max_log_size_bytes, - rtc::TaskQueue* worker_queue) { +absl::Nullable<std::unique_ptr<AecDump>> AecDumpFactory::Create( + absl::Nonnull<FILE*> handle, + int64_t max_log_size_bytes, + absl::Nonnull<TaskQueueBase*> worker_queue) { return nullptr; } } // namespace webrtc |