Reland "Send absolute capture time through audio coding module."

This is a reland of 48655cfdbfd99e0b6331e59201bcb8514f8b2a0a

Original change's description:
> Send absolute capture time through audio coding module.
>
> Bug: webrtc:10739
> Change-Id: I44e0305be7c84b253172511c2977b1d700e40c1b
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167067
> Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Reviewed-by: Chen Xing <chxg@google.com>
> Commit-Queue: Minyue Li <minyue@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30363}

Bug: webrtc:10739
Change-Id: I10086d239ad3f1efb8485098bf3b0ad23110962b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167213
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Chen Xing <chxg@google.com>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30380}
This commit is contained in:
Minyue Li
2020-01-23 13:45:50 +01:00
committed by Commit Bot
parent 6c9bc396e9
commit ff0e4dbd1f
17 changed files with 69 additions and 30 deletions

View File

@ -11,7 +11,6 @@
#include "modules/audio_coding/include/audio_coding_module.h"
#include <assert.h>
#include <algorithm>
#include <cstdint>
@ -110,6 +109,7 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
// If a re-mix is required (up or down), this buffer will store a re-mixed
// version of the input.
std::vector<int16_t> buffer;
int64_t absolute_capture_timestamp_ms;
};
InputData input_data_ RTC_GUARDED_BY(acm_crit_sect_);
@ -253,6 +253,7 @@ int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
int64_t{input_data.input_timestamp - last_timestamp_} *
encoder_stack_->RtpTimestampRateHz(),
int64_t{encoder_stack_->SampleRateHz()}));
last_timestamp_ = input_data.input_timestamp;
last_rtp_timestamp_ = rtp_timestamp;
first_frame_ = false;
@ -302,7 +303,8 @@ int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
if (packetization_callback_) {
packetization_callback_->SendData(
frame_type, encoded_info.payload_type, encoded_info.encoded_timestamp,
encode_buffer_.data(), encode_buffer_.size());
encode_buffer_.data(), encode_buffer_.size(),
input_data.absolute_capture_timestamp_ms);
}
if (vad_callback_) {
@ -392,6 +394,9 @@ int AudioCodingModuleImpl::Add10MsDataInternal(const AudioFrame& audio_frame,
input_data->input_timestamp = ptr_frame->timestamp_;
input_data->length_per_channel = ptr_frame->samples_per_channel_;
input_data->audio_channel = current_num_channels;
// TODO(bugs.webrtc.org/10739): Assign from a corresponding field in
// audio_frame when it is added in AudioFrame.
input_data->absolute_capture_timestamp_ms = 0;
if (!same_num_channels) {
// Remixes the input frame to the output data and in the process resize the