基于Android-Framework视频H264/H265解码

本文介绍了Android系统框架层进行H264和H265视频解码的关键步骤,重点讨论了解码过程中如何处理卡顿和延迟问题,包括调整sleep_time和decode_time以确保帧的准确同步和流畅播放。
摘要由CSDN通过智能技术生成

主要解码部分代码

void VideoPlayChannel::Decode()
{
    int ret =-1;
    int dec_out;
    int err_cnt =0;
    int dec_cnt =0;
    uint32_t length =0;
    uint64_t cur_time =0,last_time =0;
    uint32_t sleep_time = 0;
    if(mDecodeType == DECODE_H265)
    {
        sleep_time = 40000; // 根据实际情况来
    }else
    {
        sleep_time = mFps==0?33000:1000000/mFps;
    }
    uint32_t decode_time =1;
    uint32_t count = 0;
    int n = 0;
    ALOGD("%d doDecode  start!!!",mIndex);    
    while(mIsStarted) {
        usleep(1000);
        decode_time =0;

        if(mResetflag) {
            if(mDecoder !=NULL) {
                mDecoder->close();    
                mDecoder.clear();
                mDecoder =NULL;
            }
            if(mCodecSurface ==NULL) {
                pause();
                continue;
            }
            mDecoder = new MyAvcDecoder(mWidth, mHeight, mCodecSurface, true);
            if(mDecoder ==NULL) {
                ALOGD("%d decode creat failed",mIndex);    
                pause();
                continue;
            }
            // init decode engine type;0 is 264 mode, 1 is 265mode
            mDecoder->init(mDecodeType);
            ALOGD("reset myavcDecoder decode type %d,index %d\n",mDecodeType,mIndex);
            ums_pipe_reset(mDecode_pipe);            
            mNeedIDR =true;
            mResetflag =false;            
            mState =START;            
            continue;
        }
    
       if((ums_pipe_get_used_len(mDecode_pipe) >= 16) && (mState ==START) &&          
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--注册中心客户端--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <!--配置中心客户端--> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-authorization-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> </dependency> 以上的依赖中哪个与gateway冲突
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值