shrincy的ChinaUnix博客shrincy.blog.chinaunix.net
shrincy
全部博文(15)
编译(1)
Stagefright(9)
2014年(1)
2013年(1)
2012年(13)
gxhp1987
qqqno1
wangcong
王楠w_n
酷爱1993
shanegao
仲先生
notsurei
yyxl
分类:
2012-05-07 10:16:44
原文地址:stagefright框架(七)-Audio和Video的同步 作者:zhaixishan
size_t AudioPlayer::fillBuffer(data, size) { ... mSource->read(&mInputBuffer, ...); mInputBuffer->meta_data()->findInt64(kKeyTime, &mPositionTimeMediaUs); mPositionTimeRealUs = ((mNumFramesPlayed + size_done / mFrameSize) * 1000000) / mSampleRate; ... }
void AwesomePlayer::onVideoEvent() { ... mVideoSource->read(&mVideoBuffer, ...); mVideoBuffer->meta_data()->findInt64(kKeyTime, &timeUs); mAudioPlayer->getMediaTimeMapping(&realTimeUs, &mediaTimeUs); mTimeSourceDeltaUs = realTimeUs - mediaTimeUs; nowUs = ts->getRealTimeUs() - mTimeSourceDeltaUs; latenessUs = nowUs - timeUs; ... }
void AwesomePlayer::onVideoEvent() { ... if (latenessUs > 40000) { mVideoBuffer->release(); mVideoBuffer = NULL; postVideoEvent_l(); return; } if (latenessUs < -10000) { postVideoEvent_l(10000); return; } mVideoRenderer->render(mVideoBuffer); ... }
上一篇:stagefright框架(五)-Video Rendering
下一篇:Linux命令 -- tar
登录 注册