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/sdk/objc/native/src | |
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/sdk/objc/native/src')
-rw-r--r-- | third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.h | 4 | ||||
-rw-r--r-- | third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.mm | 12 |
2 files changed, 15 insertions, 1 deletions
diff --git a/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.h b/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.h index a86acb56fe..4ef4d0b5df 100644 --- a/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.h +++ b/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.h @@ -299,6 +299,10 @@ class AudioDeviceIOS : public AudioDeviceGeneric, // Avoids running pending task after `this` is Terminated. rtc::scoped_refptr<PendingTaskSafetyFlag> safety_ = PendingTaskSafetyFlag::Create(); + + // Ratio between mach tick units and nanosecond. Used to change mach tick + // units to nanoseconds. + double machTickUnitsToNanoseconds_; }; } // namespace ios_adm } // namespace webrtc diff --git a/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.mm b/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.mm index dd2c11bdd2..78420ec232 100644 --- a/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.mm +++ b/third_party/libwebrtc/sdk/objc/native/src/audio/audio_device_ios.mm @@ -13,6 +13,7 @@ #include "audio_device_ios.h" +#include <mach/mach_time.h> #include <cmath> #include "api/array_view.h" @@ -110,6 +111,9 @@ AudioDeviceIOS::AudioDeviceIOS(bool bypass_voice_processing) thread_ = rtc::Thread::Current(); audio_session_observer_ = [[RTCNativeAudioSessionDelegateAdapter alloc] initWithObserver:this]; + mach_timebase_info_data_t tinfo; + mach_timebase_info(&tinfo); + machTickUnitsToNanoseconds_ = (double)tinfo.numer / tinfo.denom; } AudioDeviceIOS::~AudioDeviceIOS() { @@ -376,6 +380,11 @@ OSStatus AudioDeviceIOS::OnDeliverRecordedData(AudioUnitRenderActionFlags* flags record_audio_buffer_.Clear(); record_audio_buffer_.SetSize(num_frames); + // Get audio timestamp for the audio. + // The timestamp will not have NTP time epoch, but that will be addressed by + // the TimeStampAligner in AudioDeviceBuffer::SetRecordedBuffer(). + SInt64 capture_timestamp_ns = time_stamp->mHostTime * machTickUnitsToNanoseconds_; + // Allocate AudioBuffers to be used as storage for the received audio. // The AudioBufferList structure works as a placeholder for the // AudioBuffer structure, which holds a pointer to the actual data buffer @@ -404,7 +413,8 @@ OSStatus AudioDeviceIOS::OnDeliverRecordedData(AudioUnitRenderActionFlags* flags // Get a pointer to the recorded audio and send it to the WebRTC ADB. // Use the FineAudioBuffer instance to convert between native buffer size // and the 10ms buffer size used by WebRTC. - fine_audio_buffer_->DeliverRecordedData(record_audio_buffer_, kFixedRecordDelayEstimate); + fine_audio_buffer_->DeliverRecordedData( + record_audio_buffer_, kFixedRecordDelayEstimate, capture_timestamp_ns); return noErr; } |