(转)HLS render:
1:OMX component 集成在ACodec中,ACodec(A/V)解完数据后,通知Nulayer;
2:NuPlayer通知Render,Render需要A/V的时间同步(另,如果是JPEG的话就不需要这个同步,直接render即可);
3:对于Audio,直接通过AudioSink播放;
4:对于Video,通过通知ACodec,让ACodec通过(NativeWindow/Render)发送到界面
Step1:
1.1 omx_message::FILL_BUFFER_DONE===>>>ACodec::onOMXFillBufferDone()
1.2 ACodec::onOMXFillBufferDone()::ACodec::kWhatDrainThisBuffersetMessage ===>>> NuPlayer::onMessageReceived()
Step2:
2.1 NuPlayer::renderBuffer()
2.2 NuPlayer::Renderer::queueBuffer() ===>>> send msgkWhatQueueBuffer
2.3 NuPlayer::Renderer::onMessageReceived() ===>>>onQueueBuffer()
2.4 postDrainAudioQueue() or postDrainVideoQueue() ===>>>send msg kWhatDrainVideoQueue
2.5 onMessageReceived() ===>>> onDrainVideoQueue();postDrainVideoQueue();
onDrainVideoQueue():A/V的时间同步,如果慢0.4s,标记too_late
postDrainVideoQueue():A/V的时间同步,如果解码时间快,决定等待的时间,并把消息给render
Step3:
3.1postDrainAudioQueue()===>>>onDrainAudioQueue()===>>>mAudioSink->write()
Step4:
4.1 Renderer::onDrainVideoQueue():entry->mNotifyConsumed->setInt32("render", !tooLate);
4.2 Renderer::postDrainVideoQueue()===>>> send msgkWhatDrainVideoQueue
4.2 ACodec::BaseState::onMessageReceived() ===>>>onOutputBufferDrained(msg);
http://blog.csdn.net/u010316858/article/details/50422632
(自学)
HLS android原生code主要在DEMUX部分比较复杂,目前android6.0主要是在playlistfetcher中extractAndDueueccessnitFromTs执行。具体过程还得跟踪到ATSParser和ESQueue中,后续有时间继续学习分享。