当前位置:网站首页>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);
}
边栏推荐
- arm学习-1-开发板
- strlen 转义字符
- Implementation of CAS lock-free queue
- [日常办公][杂项][vscode]tab space
- tmux概念和使用
- Install Minikube Cluster in AWS-EC2
- [Daily office][shell] Common code snippets
- C语言数组的深度分析
- AWS uses EC2 to reduce the training cost of DeepRacer: DeepRacer-for-cloud practical operation
- Deep learning, "grain and grass" first--On the way to obtain data sets
猜你喜欢
随机推荐
arm-3-中断体系结构
LeetCode_Dec_2nd_Week
LeetCode_22_Apr_2nd_Week
2020-03-27
Tensorflow/Pytorch安装(Anaconda环境下,无版本冲突,亲测有效)
枚举和联合(自定义类型)-C语言
(位操作符)按位与、按位或、按位异或
[Development Miscellaneous][Editor][Code Reading]ctags & vim
理想的生活
[daily office][ssh]cheatsheet
[日常办公][ssh]cheatsheet
Machine Learning - Processing of Text Labels for Classification Problems (Feature Engineering)
文件编辑器
arm交叉编译
Question 1000: Input two integers a and b, calculate the sum of a+b, this question is multiple sets of test data
LeetCode_Dec_1st_Week
2022在 Go (Golang) 中使用微服务的系统课程
SSO单点登陆
Shell基础
[English learning][sentence] good sentence