FFmepg 多线程解码历程 - 1:validate_thread_parameters
来源:互联网 发布:重庆网络机柜 编辑:程序博客网 时间:2024/05/16 06:10
* Set the threading algorithms used.//设置线程的使用算法
* Threading requires more than one thread.//需要一个以上的线程
* Frame threading requires entire frames to be passed to the codec,//帧线程需要整个帧被传递到编码解码器
* and introduces extra decoding delay, so is incompatible with low_delay.// 并引入了额外的解码延迟,所以是不符合low_delay
* @param avctx The context.
*/
//有效的线程参数
static void validate_thread_parameters(AVCodecContext *avctx)
{
//实现帧线程支持,需要在配置codec的时候设置codec的capabilities,flags,flags2
int frame_threading_supported = (avctx->codec->capabilities & CODEC_CAP_FRAME_THREADS)
&& !(avctx->flags & CODEC_FLAG_TRUNCATED)
&& !(avctx->flags & CODEC_FLAG_LOW_DELAY)
&& !(avctx->flags2 & CODEC_FLAG2_CHUNKS);
if (avctx->thread_count == 1) { //多线程要在双核以上的机器上才行
avctx->active_thread_type = 0;
} else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {// 在codec初始化的时候设置avctx->thread_type |=FF_THREAD_FRAME
avctx->active_thread_type = FF_THREAD_FRAME; //线程的类型设置为帧并行
} else if (avctx->codec->capabilities & CODEC_CAP_SLICE_THREADS &&
avctx->thread_type & FF_THREAD_SLICE) { //同样的要实现片级并行则需要在codec初始化的时候设置条件
avctx->active_thread_type = FF_THREAD_SLICE;
} else if (!(avctx->codec->capabilities & CODEC_CAP_AUTO_THREADS)) {
avctx->thread_count = 1;
avctx->active_thread_type = 0;
}
if (avctx->thread_count > MAX_AUTO_THREADS)
av_log(avctx, AV_LOG_WARNING,
"Application has requested %d threads. Using a thread count greater than %d is not recommended.\n",
avctx->thread_count, MAX_AUTO_THREADS);
}
注释:
如果不知到帧与片 可以查看之前的转载文章 http://blog.csdn.net/jwzhangjie/article/details/8739139
- FFmepg 多线程解码历程 - 1:validate_thread_parameters
- FFmepg 多线程解码历程 - 1:validate_thread_parameters
- FFmepg 多线程解码历程
- FFmepg 多线程解码历程
- FFmepg 多线程解码历程 - 2 :avcodec_decode_video2
- FFmepg 多线程解码历程 - 3: int ff_thread_decode_frame
- FFmepg 多线程解码历程 - 4:avcodec_open2
- FFmepg 多线程解码历程 - 5: ff_thread_init
- FFmepg 多线程解码历程 - 6:frame_thread_init
- FFmepg 多线程解码历程 - 7:submit_packet
- FFmepg 多线程解码历程 - 2 :avcodec_decode_video2
- FFmepg 多线程解码历程 - 3: int ff_thread_decode_frame
- FFmepg 多线程解码历程 - 4:avcodec_open2
- FFmepg 多线程解码历程 - 5: ff_thread_init
- FFmepg 多线程解码历程 - 6:frame_thread_init
- FFmepg 多线程解码历程 - 7:submit_packet
- ffmepg开发历程
- FFMEPG avs2 解码支持
- 各寄存器的作用
- 《生命是一种长期而持续的累积过程》摘抄
- CentOS 为Mysql建立用户组
- C#调用Win32 的部分API函数--User32.dll
- 把触发器说透
- FFmepg 多线程解码历程 - 1:validate_thread_parameters
- 上班第三个星期
- struts(二)
- QT分析之网络编程(一)
- DOS下批量文件名提取操作
- EXCEPT 和 INTERSECT
- QT分析之网络编程(二)
- linux内核内存分配
- UNIX学习之路 一步一个脚印之TCP连接的建立和终止