“Android MediaCodec trace”的版本间的差异

来自个人维基
跳转至: 导航搜索
(以“* MediaPlayer calling flow MediaPlayer mp = new MediaPlayer(); 1. mp.setDataSource(filePath); 2. mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHo...”为内容创建页面)

2020年6月9日 (二) 21:37的版本

  • MediaPlayer calling flow
MediaPlayer mp = new MediaPlayer();
1.        mp.setDataSource(filePath);
2.        mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
3.        mp.prepare(); //获取和解码媒体数据
4.        mp.start();
5.        FillBuffer
6.        EmptyBuffer

1. setDataSource(filePath);

   <MediaPlayerBase> mPlayer = Create form (playerType of source);

// => new NuPlayerDriver(pid) {
mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO);
mPlayer = new NuPlayer(pid);
}
//绑定Extractor、omx、codec2服务的death监听,
//mPlayer->setDataSource(dataSource)

2. setDisplay(SurfaceHolder sh){
mSurfaceHolder = sh;
_setVideoSurface(sh.getSurface());-->
{
MediaPlayer.cpp {
sp<IGraphicBufferProducer> new_st = surface->getIGraphicBufferProducer();
MediaPlayerService mp->setVideoSurfaceTexture(new_st);

}
real worker: MediaPlayerService
MediaPlayerService::Client::setVideoSurfaceTexture(

       const sp<IGraphicBufferProducer>& bufferProducer)

sp<ANativeWindow> anw;

   if (bufferProducer != NULL) {
       anw = new Surface(bufferProducer, true /* controlledByApp */);
       status_t err = native_window_api_connect(anw.get(),
               NATIVE_WINDOW_API_MEDIA);

p->setVideoSurfaceTexture(bufferProducer);
mConnectedWindow = anw; //decoder dequeue from buffer.Producer