当前位置:网站首页>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);
}
边栏推荐
猜你喜欢
随机推荐
CSDN大礼包--高校圆桌派大礼包
LeetCode_22_Apr_2nd_Week
[English learning][sentence] good sentence
【五一专属】阿里云ECS大测评#五一专属|向所有热爱分享的“技术劳动者”致敬#
FAREWARE ADDRESS
2020-03-27
多线程顺序输出
代码庆端午--粽你心意
Deep Learning Theory - Initialization, Parameter Adjustment
MySQL批量修改时间字段
树和二叉树
[日常办公][shell]常用代码段
MySQL存储过程学习笔记(基于8.0)
vim的介绍
LeetCode_Dec_1st_Week
安装pyspider后运行pyspider all后遇到的问题
Brief description of database and common operation guide
MNIST Handwritten Digit Recognition - Lenet-5's First Commercial Grade Convolutional Neural Network
MNIST handwritten digit recognition, sorted by from two to ten
Implementation of CAS lock-free queue








