Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云duo
FFmpeg
提交
1a5e9130
F
FFmpeg
项目概览
云duo
/
FFmpeg
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FFmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a5e9130
编写于
10月 31, 2012
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pthread: avoid copying input packets when possible.
上级
1afddbe5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
7 deletion
+13
-7
libavcodec/pthread.c
libavcodec/pthread.c
+13
-7
未找到文件。
libavcodec/pthread.c
浏览文件 @
1a5e9130
...
...
@@ -101,7 +101,8 @@ typedef struct PerThreadContext {
AVCodecContext
*
avctx
;
///< Context used to decode packets passed to this thread.
AVPacket
avpkt
;
///< Input packet (for decoding) or output (for encoding).
int
allocated_buf_size
;
///< Size allocated for avpkt.data
uint8_t
*
buf
;
///< backup storage for packet data when the input packet is not refcounted
int
allocated_buf_size
;
///< Size allocated for buf
AVFrame
frame
;
///< Output frame (for decoding) or input (for encoding).
int
got_frame
;
///< The output of got_picture_ptr from the last avcodec_decode_video() call.
...
...
@@ -522,7 +523,6 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
FrameThreadContext
*
fctx
=
p
->
parent
;
PerThreadContext
*
prev_thread
=
fctx
->
prev_thread
;
const
AVCodec
*
codec
=
p
->
avctx
->
codec
;
uint8_t
*
buf
=
p
->
avpkt
.
data
;
if
(
!
avpkt
->
size
&&
!
(
codec
->
capabilities
&
CODEC_CAP_DELAY
))
return
0
;
...
...
@@ -546,11 +546,16 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
}
}
av_
fast_malloc
(
&
buf
,
&
p
->
allocated_buf_size
,
avpkt
->
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
av_
buffer_unref
(
&
p
->
avpkt
.
buf
);
p
->
avpkt
=
*
avpkt
;
p
->
avpkt
.
data
=
buf
;
memcpy
(
buf
,
avpkt
->
data
,
avpkt
->
size
);
memset
(
buf
+
avpkt
->
size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
avpkt
->
buf
)
p
->
avpkt
.
buf
=
av_buffer_ref
(
avpkt
->
buf
);
else
{
av_fast_malloc
(
&
p
->
buf
,
&
p
->
allocated_buf_size
,
avpkt
->
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
p
->
avpkt
.
data
=
p
->
buf
;
memcpy
(
p
->
buf
,
avpkt
->
data
,
avpkt
->
size
);
memset
(
p
->
buf
+
avpkt
->
size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
}
p
->
state
=
STATE_SETTING_UP
;
pthread_cond_signal
(
&
p
->
input_cond
);
...
...
@@ -762,7 +767,8 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
pthread_cond_destroy
(
&
p
->
input_cond
);
pthread_cond_destroy
(
&
p
->
progress_cond
);
pthread_cond_destroy
(
&
p
->
output_cond
);
av_freep
(
&
p
->
avpkt
.
data
);
av_buffer_unref
(
&
p
->
avpkt
.
buf
);
av_freep
(
&
p
->
buf
);
if
(
i
)
{
av_freep
(
&
p
->
avctx
->
priv_data
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录