WebRTC录音

 录音流程: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

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值