diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /third_party/libwebrtc/modules/audio_device | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/modules/audio_device')
8 files changed, 28 insertions, 14 deletions
diff --git a/third_party/libwebrtc/modules/audio_device/BUILD.gn b/third_party/libwebrtc/modules/audio_device/BUILD.gn index a135f042db..1672be3f95 100644 --- a/third_party/libwebrtc/modules/audio_device/BUILD.gn +++ b/third_party/libwebrtc/modules/audio_device/BUILD.gn @@ -91,6 +91,7 @@ if (!build_with_mozilla) { # See Bug 1820869. "../../system_wrappers", "../../system_wrappers:metrics", ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } } @@ -213,7 +214,6 @@ if (!build_with_chromium) { "../../rtc_base:platform_thread", "../../rtc_base:random", "../../rtc_base:rtc_event", - "../../rtc_base:rtc_task_queue", "../../rtc_base:safe_conversions", "../../rtc_base:timeutils", "../../rtc_base/synchronization:mutex", @@ -461,6 +461,7 @@ rtc_source_set("mock_audio_device") { "../../api:make_ref_counted", "../../test:test_support", ] + absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] } } diff --git a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.cc b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.cc index 86240da196..f483b8dc79 100644 --- a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.cc +++ b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.cc @@ -13,6 +13,7 @@ #include <cstdint> #include <cstring> +#include "api/array_view.h" #include "modules/audio_device/audio_device_buffer.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" @@ -107,7 +108,8 @@ void FineAudioBuffer::GetPlayoutData(rtc::ArrayView<int16_t> audio_buffer, void FineAudioBuffer::DeliverRecordedData( rtc::ArrayView<const int16_t> audio_buffer, - int record_delay_ms) { + int record_delay_ms, + absl::optional<int64_t> capture_time_ns) { RTC_DCHECK(IsReadyForRecord()); // Always append new data and grow the buffer when needed. record_buffer_.AppendData(audio_buffer.data(), audio_buffer.size()); @@ -118,7 +120,8 @@ void FineAudioBuffer::DeliverRecordedData( record_channels_ * record_samples_per_channel_10ms_; while (record_buffer_.size() >= num_elements_10ms) { audio_device_buffer_->SetRecordedBuffer(record_buffer_.data(), - record_samples_per_channel_10ms_); + record_samples_per_channel_10ms_, + capture_time_ns); audio_device_buffer_->SetVQEData(playout_delay_ms_, record_delay_ms); audio_device_buffer_->DeliverRecordedData(); memmove(record_buffer_.data(), record_buffer_.data() + num_elements_10ms, diff --git a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.h b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.h index a6c3042bb2..7af41d3b21 100644 --- a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.h +++ b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer.h @@ -11,6 +11,10 @@ #ifndef MODULES_AUDIO_DEVICE_FINE_AUDIO_BUFFER_H_ #define MODULES_AUDIO_DEVICE_FINE_AUDIO_BUFFER_H_ +#include <cstddef> +#include <cstdint> + +#include "absl/types/optional.h" #include "api/array_view.h" #include "rtc_base/buffer.h" @@ -61,7 +65,12 @@ class FineAudioBuffer { // 5ms of data and sends a total of 10ms to WebRTC and clears the internal // cache. Call #3 restarts the scheme above. void DeliverRecordedData(rtc::ArrayView<const int16_t> audio_buffer, - int record_delay_ms); + int record_delay_ms) { + DeliverRecordedData(audio_buffer, record_delay_ms, absl::nullopt); + } + void DeliverRecordedData(rtc::ArrayView<const int16_t> audio_buffer, + int record_delay_ms, + absl::optional<int64_t> capture_time_ns); private: // Device buffer that works with 10ms chunks of data both for playout and diff --git a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer_unittest.cc b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer_unittest.cc index 36ea85f7dd..bb9fe63922 100644 --- a/third_party/libwebrtc/modules/audio_device/fine_audio_buffer_unittest.cc +++ b/third_party/libwebrtc/modules/audio_device/fine_audio_buffer_unittest.cc @@ -113,7 +113,7 @@ void RunFineBufferTest(int frame_size_in_samples) { { InSequence s; for (int j = 0; j < kNumberOfUpdateBufferCalls - 1; ++j) { - EXPECT_CALL(audio_device_buffer, SetRecordedBuffer(_, kSamplesPer10Ms)) + EXPECT_CALL(audio_device_buffer, SetRecordedBuffer(_, kSamplesPer10Ms, _)) .WillOnce(VerifyInputBuffer(j, kChannels * kSamplesPer10Ms)) .RetiresOnSaturation(); } diff --git a/third_party/libwebrtc/modules/audio_device/include/test_audio_device.cc b/third_party/libwebrtc/modules/audio_device/include/test_audio_device.cc index 4c29c98f2c..b3923ae67d 100644 --- a/third_party/libwebrtc/modules/audio_device/include/test_audio_device.cc +++ b/third_party/libwebrtc/modules/audio_device/include/test_audio_device.cc @@ -21,6 +21,7 @@ #include "absl/strings/string_view.h" #include "api/array_view.h" #include "api/make_ref_counted.h" +#include "api/task_queue/task_queue_factory.h" #include "common_audio/wav_file.h" #include "modules/audio_device/audio_device_impl.h" #include "modules/audio_device/include/audio_device_default.h" @@ -33,7 +34,6 @@ #include "rtc_base/platform_thread.h" #include "rtc_base/random.h" #include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/time_utils.h" diff --git a/third_party/libwebrtc/modules/audio_device/mock_audio_device_buffer.h b/third_party/libwebrtc/modules/audio_device/mock_audio_device_buffer.h index b0f54c20ff..0b276185da 100644 --- a/third_party/libwebrtc/modules/audio_device/mock_audio_device_buffer.h +++ b/third_party/libwebrtc/modules/audio_device/mock_audio_device_buffer.h @@ -11,6 +11,7 @@ #ifndef MODULES_AUDIO_DEVICE_MOCK_AUDIO_DEVICE_BUFFER_H_ #define MODULES_AUDIO_DEVICE_MOCK_AUDIO_DEVICE_BUFFER_H_ +#include "absl/types/optional.h" #include "modules/audio_device/audio_device_buffer.h" #include "test/gmock.h" @@ -24,7 +25,9 @@ class MockAudioDeviceBuffer : public AudioDeviceBuffer { MOCK_METHOD(int32_t, GetPlayoutData, (void* audioBuffer), (override)); MOCK_METHOD(int32_t, SetRecordedBuffer, - (const void* audioBuffer, size_t nSamples), + (const void* audioBuffer, + size_t nSamples, + absl::optional<int64_t> capture_time_ns), (override)); MOCK_METHOD(void, SetVQEData, (int playDelayMS, int recDelayMS), (override)); MOCK_METHOD(int32_t, DeliverRecordedData, (), (override)); diff --git a/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.cc b/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.cc index 627e68b36f..a3742ea581 100644 --- a/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.cc +++ b/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.cc @@ -19,7 +19,6 @@ #include "modules/audio_device/include/test_audio_device.h" #include "rtc_base/checks.h" #include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" #include "rtc_base/task_utils/repeating_task.h" namespace webrtc { @@ -59,11 +58,10 @@ TestAudioDevice::TestAudioDevice( } AudioDeviceGeneric::InitStatus TestAudioDevice::Init() { - task_queue_ = - std::make_unique<rtc::TaskQueue>(task_queue_factory_->CreateTaskQueue( - "TestAudioDeviceModuleImpl", TaskQueueFactory::Priority::NORMAL)); + task_queue_ = task_queue_factory_->CreateTaskQueue( + "TestAudioDeviceModuleImpl", TaskQueueFactory::Priority::NORMAL); - RepeatingTaskHandle::Start(task_queue_->Get(), [this]() { + RepeatingTaskHandle::Start(task_queue_.get(), [this]() { ProcessAudio(); return TimeDelta::Micros(process_interval_us_); }); diff --git a/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.h b/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.h index 36192b7f7f..84b48948ba 100644 --- a/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.h +++ b/third_party/libwebrtc/modules/audio_device/test_audio_device_impl.h @@ -14,6 +14,7 @@ #include <memory> #include <vector> +#include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_factory.h" #include "modules/audio_device/audio_device_buffer.h" #include "modules/audio_device/audio_device_generic.h" @@ -22,7 +23,6 @@ #include "modules/audio_device/include/test_audio_device.h" #include "rtc_base/buffer.h" #include "rtc_base/synchronization/mutex.h" -#include "rtc_base/task_queue.h" namespace webrtc { @@ -190,7 +190,7 @@ class TestAudioDevice : public AudioDeviceGeneric { std::vector<int16_t> playout_buffer_ RTC_GUARDED_BY(lock_); rtc::BufferT<int16_t> recording_buffer_ RTC_GUARDED_BY(lock_); - std::unique_ptr<rtc::TaskQueue> task_queue_; + std::unique_ptr<TaskQueueBase, TaskQueueDeleter> task_queue_; }; } // namespace webrtc |