采集时封装格式AudioFrame:见Channel::ProcessAndEncodeAudioOnTaskQueue()
audio_input->timestamp_ = _timeStamp; //_timeStamp初始值为 0
_timeStamp += static_cast<uint32_t>(audio_input->samples_per_channel_);
audio_input->timestamp_的值为采样个数的累加,以48000采样率为例子,对应时间戳为:
0,480,960,... ...
编码前封装格式InputData:见AudioCodingModuleImpl::Add10MsDataInternal()
InputData.input_timestamp = AudioFrame.timestamp_;
发送时对时间戳的处理:见RTPSender::SendOutgoingData()
rtp_timestamp = timestamp_offset_ + capture_timestamp;其中:
timestamp_offset_ = random_.Rand<uint32_t>();
capture_timestamp = InputData.input_timestamp = AudioFrame.timestamp_所以:
rtp_timestamp = timestamp_offset_ + AudioFrame.timestamp_;