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

来自个人维基
跳转至: 导航搜索
(以“* MediaPlayer calling flow MediaPlayer mp = new MediaPlayer(); 1. mp.setDataSource(filePath); 2. mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHo...”为内容创建页面)
 
第8行: 第8行:
 
  6.        EmptyBuffer
 
  6.        EmptyBuffer
  
1.  setDataSource(filePath);
+
1.  setDataSource(filePath)
     <MediaPlayerBase> mPlayer = Create form (playerType of source);
+
 
 +
     <source lang="c">
 +
<MediaPlayerBase> mPlayer = Create form (playerType of source);
 
//      => new NuPlayerDriver(pid) {
 
//      => new NuPlayerDriver(pid) {
 
mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO);
 
mLooper->setName("NuPlayerDriver Looper")->start(PRIORITY_AUDIO);
第16行: 第18行:
 
//绑定Extractor、omx、codec2服务的death监听,
 
//绑定Extractor、omx、codec2服务的death监听,
 
//mPlayer->setDataSource(dataSource)
 
//mPlayer->setDataSource(dataSource)
 +
</source>
 
 
2. setDisplay(SurfaceHolder sh){
+
2. setDisplay(SurfaceHolder sh)
  mSurfaceHolder = sh;
+
<source lang="c">
  _setVideoSurface(sh.getSurface());-->
+
{
  {
+
  mSurfaceHolder = sh;
  MediaPlayer.cpp {
+
  _setVideoSurface(sh.getSurface());-->
    sp<IGraphicBufferProducer> new_st =  surface->getIGraphicBufferProducer();
+
  {
MediaPlayerService mp->setVideoSurfaceTexture(new_st);
+
      MediaPlayer.cpp {
+
  sp<IGraphicBufferProducer> new_st =  surface->getIGraphicBufferProducer();
  }
+
  MediaPlayerService mp->setVideoSurfaceTexture(new_st);
real worker: MediaPlayerService
+
      }
MediaPlayerService::Client::setVideoSurfaceTexture(
+
      MediaPlayerService::Client::setVideoSurfaceTexture(<IGraphicBufferProducer>& bufferProducer)
        const sp<IGraphicBufferProducer>& bufferProducer)
+
      sp<ANativeWindow> anw;
+
      if (bufferProducer != NULL) {
sp<ANativeWindow> anw;
+
    if (bufferProducer != NULL) {
+
 
         anw = new Surface(bufferProducer, true /* controlledByApp */);
 
         anw = new Surface(bufferProducer, true /* controlledByApp */);
 
         status_t err = native_window_api_connect(anw.get(),
 
         status_t err = native_window_api_connect(anw.get(),
 
                 NATIVE_WINDOW_API_MEDIA);
 
                 NATIVE_WINDOW_API_MEDIA);
  
p->setVideoSurfaceTexture(bufferProducer);
+
        p->setVideoSurfaceTexture(bufferProducer);
mConnectedWindow = anw; //decoder dequeue from buffer.Producer
+
        mConnectedWindow = anw; //decoder
 +
    }
 +
}
 +
 
 +
</source>

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

  • 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);
       }
       MediaPlayerService::Client::setVideoSurfaceTexture(<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
    }
}