ffplayer——render流程和buffer分配

本文介绍了FFMPlayer的视频准备和启动过程中涉及的渲染流程,包括显示和解码共享内存机制,强调其速度优势和低IO吞吐量。在主线程中,初始化渲染并分配解码缓冲区;在显示线程中,处理显示事件并进行帧渲染。文章还探讨了Android中native_handle_t、private_handle_t、buffer_handle_t、ANativeWindowBuffer和Surface等概念,以及它们在缓冲区管理中的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

采用显示和解码共享内存机制,相比较与旧的机制有速度快、IO吞吐量低的特点。

在主线程中:
FFMPlayer::prepareVideo()

–>initRender(mColorFormat, 0,HW);

—–>checkReAllocateBuffers(decoderType, isInfoChange);

———->mNativeWindowBufferAlloctor->initparm()//初始化sp FFMPlayerBase::mNativeWindow;
//NativeWindowBufferAlloctor* FFMPlayerBase::mNativeWindowBufferAlloctor;

void NativeWindowBufferAlloctor::initparm(sp<ANativeWindow> nativeWindow, int w, int h, int dw, int dh)
{
  
  //设置所需要分配内存的基本参数,参数包括NativeWindow指针、虚宽、虚高、实宽、实高。
    mNativeWindow = nativeWindow;
    mVideoWidth = w;
    mVideoHeight = h;
    if (dw==0 || dh==0) {
        mDisplayWidth = w;
        mDisplayHeight = h;
    } else {
        mDisplayWidth = dw;
        mDisplayHeight = dh;
    }
}

FFMPlayer::doStart()

–>allocDecoderBuffer(mNewAllocMode);//FFMPlayerBase::allocDecoderBuffer(bool aync)

—–>mNativeWindowBufferAlloctor->allo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值