Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
ddebfb15
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ddebfb15
编写于
7月 25, 2005
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
thread mess check for avcodec_open/close()
Originally committed as revision 4472 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
91d44ffc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
6 deletion
+25
-6
libavcodec/utils.c
libavcodec/utils.c
+25
-6
未找到文件。
libavcodec/utils.c
浏览文件 @
ddebfb15
...
...
@@ -68,6 +68,8 @@ const uint8_t ff_reverse[256]={
0x0F
,
0x8F
,
0x4F
,
0xCF
,
0x2F
,
0xAF
,
0x6F
,
0xEF
,
0x1F
,
0x9F
,
0x5F
,
0xDF
,
0x3F
,
0xBF
,
0x7F
,
0xFF
,
};
static
int
volatile
entangled_thread_counter
=
0
;
void
avcodec_default_free_buffers
(
AVCodecContext
*
s
);
void
*
av_mallocz
(
unsigned
int
size
)
...
...
@@ -522,10 +524,16 @@ AVFrame *avcodec_alloc_frame(void){
int
avcodec_open
(
AVCodecContext
*
avctx
,
AVCodec
*
codec
)
{
int
ret
;
int
ret
=
-
1
;
entangled_thread_counter
++
;
if
(
entangled_thread_counter
!=
1
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"insufficient thread locking around avcodec_open/close()
\n
"
);
goto
end
;
}
if
(
avctx
->
codec
)
return
-
1
;
goto
end
;
avctx
->
codec
=
codec
;
avctx
->
codec_id
=
codec
->
id
;
...
...
@@ -533,7 +541,7 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
if
(
codec
->
priv_data_size
>
0
)
{
avctx
->
priv_data
=
av_mallocz
(
codec
->
priv_data_size
);
if
(
!
avctx
->
priv_data
)
return
-
ENOMEM
;
goto
end
;
}
else
{
avctx
->
priv_data
=
NULL
;
}
...
...
@@ -545,15 +553,18 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
if
((
avctx
->
coded_width
||
avctx
->
coded_height
)
&&
avcodec_check_dimensions
(
avctx
,
avctx
->
coded_width
,
avctx
->
coded_height
)){
av_freep
(
&
avctx
->
priv_data
);
return
-
1
;
goto
end
;
}
ret
=
avctx
->
codec
->
init
(
avctx
);
if
(
ret
<
0
)
{
av_freep
(
&
avctx
->
priv_data
);
return
ret
;
goto
end
;
}
return
0
;
ret
=
0
;
end:
entangled_thread_counter
--
;
return
ret
;
}
int
avcodec_encode_audio
(
AVCodecContext
*
avctx
,
uint8_t
*
buf
,
int
buf_size
,
...
...
@@ -670,11 +681,19 @@ int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
int
avcodec_close
(
AVCodecContext
*
avctx
)
{
entangled_thread_counter
++
;
if
(
entangled_thread_counter
!=
1
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"insufficient thread locking around avcodec_open/close()
\n
"
);
entangled_thread_counter
--
;
return
-
1
;
}
if
(
avctx
->
codec
->
close
)
avctx
->
codec
->
close
(
avctx
);
avcodec_default_free_buffers
(
avctx
);
av_freep
(
&
avctx
->
priv_data
);
avctx
->
codec
=
NULL
;
entangled_thread_counter
--
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录