当前位置:网站首页>webrtc代码解读二:音视频播放同步过程
webrtc代码解读二:音视频播放同步过程
2022-08-04 05:32:00 【睏哥RTC】
在rtp包来是获取当前时间戳到本地变量:
Channel::OnRtpPacket -> Channel::UpdatePlayoutTimestamp -> AudioCodingModuleImpl::PlayoutTimestamp -> AcmReceiver::GetPlayoutTimestamp -> NetEqImpl::GetPlayoutTimestamp
从成员变量读取播放时间戳:
VideoReceiveStream::OnFrame -> RtpStreamsSynchronizer::GetStreamSyncOffsetInMs -> AudioReceiveStream::GetPlayoutTimestamp -> ChannelProxy::GetPlayoutTimestamp -> Channel::GetPlayoutTimestamp 获取 playout_timestamp_rtp_
void VideoReceiveStream::OnFrame(const VideoFrame& video_frame) {
int64_t sync_offset_ms;
double estimated_freq_khz;
// TODO(tommi): GetStreamSyncOffsetInMs grabs three locks. One inside the
// function itself, another in GetChannel() and a third in
// GetPlayoutTimestamp. Seems excessive. Anyhow, I'm assuming the function
// succeeds most of the time, which leads to grabbing a fourth lock.
if (rtp_stream_sync_.GetStreamSyncOffsetInMs(video_frame.timestamp(),
video_frame.render_time_ms(),
&sync_offset_ms,
&estimated_freq_khz)) {
// TODO(tommi): OnSyncOffsetUpdated grabs a lock.
stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms, estimated_freq_khz);
}
// config_.renderer must never be null if we're getting this callback.
config_.renderer->OnFrame(video_frame);
// TODO(tommi): OnRenderFrame grabs a lock too.
stats_proxy_.OnRenderedFrame(video_frame);
}
边栏推荐
猜你喜欢
随机推荐
LeetCode_Nov_3rd_Week
LeetCode_Nov_4th_Week
[开发杂项][调试]debug into kernel
使用JS在浏览器中打印菱形
管道重定向
LeetCode_22_Apr_2nd_Week
MySQL基础
亚马逊云科技Build On-Amazon Neptune基于知识图谱的推荐模型构建心得
IDEA中创建web项目实现步骤
2022在 Go (Golang) 中使用微服务的系统课程
SFTP的用法
vim的介绍
题目1000:输入两个整数a和b,计算a+b的和,此题是多组测试数据
AWS uses EC2 to reduce the training cost of DeepRacer: DeepRacer-for-cloud practical operation
Install Minikube Cluster in AWS-EC2
Golang environment variable settings (2)--GOMODULE & GOPROXY
[Daily office][shell] Common code snippets
LeetCode_22_Apr_4th_Week
LeetCode_Nov_4th_Week
(Navigation page) OpenStack-M version - manual construction of two nodes - with video from station B









