录音流程:AudioDeviceLinuxPulse::RecThreadProcess()负责采集音频数据,传递到AudioDeviceBuffer中缓存,AudioDeviceBuffer则将数据送入TransmixMixer,首先交给AudioProcess进行近端音频处理,完成后分发到各个Channel中,Channel则通过AudioCodingModule进行编码,编码后再交付到RtpRtcp中经由RTPSender发送出去。
AudioDeviceLinuxPulse::RecThreadProcess
AudioDeviceLinuxPulse::ProcessRecordedData
AudioDeviceLinuxPulse::ReadRecordedData
// Provide data to VoiceEngine
if (ProcessRecordedData(_recBuffer, numRecSamples, recDelay) == -1)
{
// We have stopped recording
return -1;
}
AudioDeviceBuffer::DeliverRecordedData
VoEBaseImpl::RecordedDataIsAvailable
VoEBaseImpl::ProcessRecordedDataWithAPM
VoEBaseImpl::ProcessRecordedDataWithAPM
TransmitMixer::PrepareDemux
TransmitMixer::GenerateAudioFrame
VoEBaseImpl::ProcessRecordedDataWithAPM
TransmitMixer::DemuxAndMix
Channel::Demultiplex
Channel::PrepareEncodeAndSend
TransmitMixer::EncodeAndSend
Channel::EncodeAndSend
{
...
// The ACM resamples internally.
_audioFrame.timestamp_ = _timeStamp;
if (audio_coding_->Add10MsData((AudioFrame&)_audioFrame) != 0)
{
WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::EncodeAndSend() ACM encoding failed");
return -1;
}
return audio_coding_->Process();
...
}
AudioCodingModuleImpl::Add10MsData
AudioCodingModuleImpl::PreprocessToAddData
ACMGenericCodec::Add10MsData
Reason:
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs]
if (codecs_[current_send_codec_idx_]->Add10MsData(
ptr_frame->timestamp_, ptr_audio, ptr_frame->samples_per_channel_,
send_codec_inst_.channels) < 0)
return -1;
int32_t ACMGenericCodec::Add10MsData(const uint32_t timestamp,
const int16_t* data,
const uint16_t length_smpl,
const uint8_t audio_channel) {
WriteLockScoped wl(codec_wrapper_lock_);
return Add10MsDataSafe(timestamp, data, length_smpl, audio_channel);
}
ACMGenericCodec::Add10MsDataSafe
audio_coding_->Process();
AudioCodingModuleImpl::Process()
AudioCodingModuleImpl::ProcessSingleStream()
{
...
status = codecs_[current_send_codec_idx_]->Encode(stream, &length_bytes,
&rtp_timestamp,
&encoding_type);
...
}
ACMGenericCodec::Encode
AudioCodingModuleImpl::ProcessSingleStream Channel::SendData
ModuleRtpRtcpImpl::SendOutgoingData
RTPSender::SendOutgoingData
RTPSender::BuildRTPheader
RTPSender::SendToNetwork
Channel::SendPacket
BaseChannel::SendPacket
P2PTransportChannel::SendPacket
AsyncUDPSocket::SendTo
PhysicalSocket: Sendto
来自:
http://blog.csdn.net/u014338577/article/details/45825381