Change ChannelReceive::GetAudioFrameWithInfo to use new Converts method

Use the new Converts function added in webrtc-review.googlesource.com/c/src/+/320080. Later this will also be added to video.
This change is part of an effort to get Glass 2 Glass metrics. This particular change is not needed, but I intend to add this code to video, and thinks it's nice if the code for video and audio looks the same.

Bug: None
Change-Id: I04caff0dbef1cd4f391bbaa4f8bdee0e66043888
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/320281
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Commit-Queue: Olov Brändström <brandstrom@google.com>
Cr-Commit-Position: refs/heads/main@{#40753}
This commit is contained in:
Olov Brändström 2023-09-14 14:00:11 +02:00 committed by WebRTC LUCI CQ
parent b64615a194
commit ad12dc52b7

View File

@ -475,21 +475,15 @@ AudioMixer::Source::AudioFrameInfo ChannelReceive::GetAudioFrameWithInfo(
// Fill in local capture clock offset in `audio_frame->packet_infos_`. // Fill in local capture clock offset in `audio_frame->packet_infos_`.
RtpPacketInfos::vector_type packet_infos; RtpPacketInfos::vector_type packet_infos;
for (auto& packet_info : audio_frame->packet_infos_) { for (auto& packet_info : audio_frame->packet_infos_) {
absl::optional<int64_t> local_capture_clock_offset_q32x32; RtpPacketInfo new_packet_info(packet_info);
if (packet_info.absolute_capture_time().has_value()) { if (packet_info.absolute_capture_time().has_value()) {
MutexLock lock(&ts_stats_lock_); MutexLock lock(&ts_stats_lock_);
local_capture_clock_offset_q32x32 = new_packet_info.set_local_capture_clock_offset(
capture_clock_offset_updater_.AdjustEstimatedCaptureClockOffset( capture_clock_offset_updater_.ConvertsToTimeDela(
packet_info.absolute_capture_time() capture_clock_offset_updater_.AdjustEstimatedCaptureClockOffset(
->estimated_capture_clock_offset); packet_info.absolute_capture_time()
->estimated_capture_clock_offset)));
} }
RtpPacketInfo new_packet_info(packet_info);
absl::optional<TimeDelta> local_capture_clock_offset;
if (local_capture_clock_offset_q32x32.has_value()) {
local_capture_clock_offset = TimeDelta::Millis(
Q32x32ToInt64Ms(*local_capture_clock_offset_q32x32));
}
new_packet_info.set_local_capture_clock_offset(local_capture_clock_offset);
packet_infos.push_back(std::move(new_packet_info)); packet_infos.push_back(std::move(new_packet_info));
} }
audio_frame->packet_infos_ = RtpPacketInfos(packet_infos); audio_frame->packet_infos_ = RtpPacketInfos(packet_infos);