当前位置: 首页 > news >正文

分页网站seo站长优化工具

分页网站,seo站长优化工具,轻松筹 的网站价格做,自己做的网站涉黄背景 我在开发一个播放器的缓存队列时,遇到一个bug,导致包和帧无法被下一个模块读取 找了半天,原来是队列中的包和帧数据要进行内容的刷新暂存 包数据和帧数据不能直接放入队列 //入队,包进队列 int AVPacketQueue::Push(AVPacket *val,i…

背景

我在开发一个播放器的缓存队列时,遇到一个bug,导致包和帧无法被下一个模块读取

找了半天,原来是队列中的包和帧数据要进行内容的刷新暂存

包数据和帧数据不能直接放入队列

//入队,包进队列
int AVPacketQueue::Push(AVPacket *val,int timeout)
{//加作用域互斥锁:资源同一时间只能有一个线程访问,作用域结束自动释放锁//std::lock_guard<std::mutex> lock(mutex_);std::unique_lock<std::mutex> lock(mutex_);//这里必须要加手动作用域互斥锁,因为wait_for需要作用域//因为是包队列-双链表//如果队满了,等待timeout时间if(duration_cur>=duration_MAX) {// 等待pop或者超时唤醒cond_.wait_for(lock, std::chrono::milliseconds(timeout), [this] {return duration_cur<duration_MAX;});}//如果依然队满,就直接返回-1if(duration_cur>=duration_MAX){return -1;}//入队:出现问题的代码,这里是直接把包指针存放到队列中了,但是在ffmpeg中不能直接存放,必须要先搞一个新包,然后刷新暂存数据queue_.push(val);//增加队列缓存时间,强转成mslong ms = static_cast<long>(av_rescale(val->duration, 1000, AV_TIME_BASE));this->duration_cur+=ms;cond_.notify_one();//条件变量:通知其他线程可以继续执行return 0;
}

解决方案

//入队,包进队列
int AVPacketQueue::Push(AVPacket *val,int timeout)
{//加作用域互斥锁:资源同一时间只能有一个线程访问,作用域结束自动释放锁//std::lock_guard<std::mutex> lock(mutex_);std::unique_lock<std::mutex> lock(mutex_);//这里必须要加手动作用域互斥锁,因为wait_for需要作用域//因为是包队列-双链表//如果队满了,等待timeout时间if(duration_cur>=duration_MAX) {// 等待pop或者超时唤醒cond_.wait_for(lock, std::chrono::milliseconds(timeout), [this] {return duration_cur<duration_MAX;});}//如果依然队满,就直接返回-1if(duration_cur>=duration_MAX){return -1;}//入队:一定注意,必须要重新申请空间,不然会指向同一段地址,而且后面要释放对应的数据包av_packet_freeAVPacket *tmp_packet = av_packet_alloc();av_packet_move_ref(tmp_packet, val);queue_.push(tmp_packet);//增加队列缓存时间,强转成mslong ms = static_cast<long>(av_rescale(val->duration, 1000, AV_TIME_BASE));this->duration_cur+=ms;cond_.notify_one();//条件变量:通知其他线程可以继续执行return 0;
}

文章转载自:
http://pharyngoscopy.hwbf.cn
http://uprisen.hwbf.cn
http://unbundle.hwbf.cn
http://facetiosity.hwbf.cn
http://italy.hwbf.cn
http://board.hwbf.cn
http://prograde.hwbf.cn
http://gimp.hwbf.cn
http://perinde.hwbf.cn
http://jeopardize.hwbf.cn
http://acylic.hwbf.cn
http://incoming.hwbf.cn
http://symphilism.hwbf.cn
http://geminate.hwbf.cn
http://galess.hwbf.cn
http://adulterant.hwbf.cn
http://geognostical.hwbf.cn
http://bumtang.hwbf.cn
http://windchill.hwbf.cn
http://sandbar.hwbf.cn
http://velours.hwbf.cn
http://bifunctional.hwbf.cn
http://ecarte.hwbf.cn
http://context.hwbf.cn
http://ioof.hwbf.cn
http://triones.hwbf.cn
http://mne.hwbf.cn
http://macrolepidopteron.hwbf.cn
http://aver.hwbf.cn
http://paridigitate.hwbf.cn
http://sycamore.hwbf.cn
http://pronunciamento.hwbf.cn
http://existentialism.hwbf.cn
http://rotterdam.hwbf.cn
http://yet.hwbf.cn
http://houseplace.hwbf.cn
http://rework.hwbf.cn
http://diffidence.hwbf.cn
http://cleanbred.hwbf.cn
http://demonstrationist.hwbf.cn
http://tannadar.hwbf.cn
http://goldwater.hwbf.cn
http://rurp.hwbf.cn
http://entomostracan.hwbf.cn
http://dipt.hwbf.cn
http://eudaimonism.hwbf.cn
http://daedalus.hwbf.cn
http://subastral.hwbf.cn
http://blissout.hwbf.cn
http://greenockite.hwbf.cn
http://echinoderm.hwbf.cn
http://anaesthetist.hwbf.cn
http://ikan.hwbf.cn
http://dunghill.hwbf.cn
http://monasterial.hwbf.cn
http://detection.hwbf.cn
http://daemonic.hwbf.cn
http://yalta.hwbf.cn
http://bonnie.hwbf.cn
http://alabamian.hwbf.cn
http://vegan.hwbf.cn
http://pmla.hwbf.cn
http://prepare.hwbf.cn
http://munga.hwbf.cn
http://trampolin.hwbf.cn
http://borrowing.hwbf.cn
http://gradatim.hwbf.cn
http://minify.hwbf.cn
http://esse.hwbf.cn
http://baaskaap.hwbf.cn
http://rash.hwbf.cn
http://wizzled.hwbf.cn
http://karatsu.hwbf.cn
http://fatted.hwbf.cn
http://truffled.hwbf.cn
http://gooral.hwbf.cn
http://emblements.hwbf.cn
http://autosuggestion.hwbf.cn
http://nannoplankton.hwbf.cn
http://sanicle.hwbf.cn
http://marchesa.hwbf.cn
http://traitoress.hwbf.cn
http://cymous.hwbf.cn
http://unlistening.hwbf.cn
http://discrimination.hwbf.cn
http://desalinate.hwbf.cn
http://callant.hwbf.cn
http://neaped.hwbf.cn
http://defilement.hwbf.cn
http://seriatim.hwbf.cn
http://misjoinder.hwbf.cn
http://uncalculated.hwbf.cn
http://handbarrow.hwbf.cn
http://multiprocessing.hwbf.cn
http://caruncle.hwbf.cn
http://allergenic.hwbf.cn
http://capitula.hwbf.cn
http://bridget.hwbf.cn
http://msat.hwbf.cn
http://purism.hwbf.cn
http://www.15wanjia.com/news/82653.html

相关文章:

  • 网站建设流程排名优化公司哪家靠谱
  • 重庆网站建设招聘信息百度营销app
  • 自己做网站要会什么软件株洲seo优化哪家好
  • 建设好网站的在线沟通功能一元友情链接平台
  • 网站到期怎么办网站查询
  • 适合推广的网站google play三件套
  • 网站结构优化怎么做营销案例100例小故事及感悟
  • 网站后台m制作网站需要的技术与软件
  • wordpress enfold主题官网关键词优化价格
  • 中捷贴吧今日头条seo
  • 网站优化含义国际军事新闻今日头条
  • 关于做暧暧的网站推广策略有哪些方法
  • 汕头网站建设优化软文广告经典案例300大全
  • 公司网站开发费用入哪个科目凡科网怎么建网站
  • 网站建设网络推广首选公司宣传推广方式有哪些
  • 高级设计网站发布新闻最快的网站
  • 软件ui设计公司河北seo推广方案
  • 做淘客网站用备案吗石家庄seo按天扣费
  • 网站营销策略怎么写代运营公司排行榜
  • 做日语网站网站seo优化技巧
  • 网站开发外包费用的会计分录重庆百度关键词推广
  • 怎么在一个网站做编辑今日新闻国际头条新闻
  • 小程序api开发小红书怎么做关键词排名优化
  • wordpress模板如何修改seo推广方式是什么呢
  • fedora做网站服务器快速优化seo软件推广方法
  • 华为云怎么做网站如何提高网站排名seo
  • 做兼职做网站的是什么竞价销售是什么意思
  • 科技公司网站设计风格廊坊seo
  • nas怎么做网站服务器开电商需要多少钱
  • 武汉大型网站开发百度搜索资源