当前位置:网站首页>av_read_frame 阻塞,基于回调的解决办法
av_read_frame 阻塞,基于回调的解决办法
2022-08-04 05:34:00 【_杜竞宁_】
设置回调,每次 av_read_frame 前刷新时间
static int InterruptFouction(void *theTimeSpec)
{
if (!theTimeSpec) {
return 0;
}
std::cout << "InterruptFouction called~!" << std::endl;
time_t mtime;
time(&mtime);
time_t *t = (time_t*)theTimeSpec;
if( ( mtime - *t ) > 5) {
return 1;
}
return 0;
}
time_t TimeNow;
m_pFmtCtx->interrupt_callback.callback = InterruptFouction;
m_pFmtCtx->interrupt_callback.opaque = &TimeNow;
while(isRunning){
time(&TimeNow);
ret = av_read_frame(m_pFmtCtx, m_pAVPacket);
if ( ret == 0 ) {
// to do something
} else {
break;
}
}
边栏推荐
猜你喜欢
随机推荐
基于语音识别的QT设计的csgo互动类视频游戏
文件权限管理 ugo
动态内存管理-C语言
键盘扫描码
MySQL存储过程学习笔记(基于8.0)
gRPC intro 1:RPC
C语言数组的深度分析
Pipe redirection
数据库实体类对应daoimpl,基础的增删改查。
实现高并发服务器(二)
常见的一些排序
JUC锁框架——CountDownLatch、CyclicBarrier和Semaphore
file editor
Unity Day03
JDBC第一学之进行数据库连接时出现The server time zone.....解决办法
关于gopher协议的ssrf攻击
Scheduler (Long-term,Short-term, Medium-term Scheduler) & Dispatcher
分布式cache项目
给想要转行渗透测试人的忠告
JUC并发容器——阻塞队列









