Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4b6869d6
Commit
4b6869d6
authored
Dec 06, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitstream: make vlc init of static tables thread safe.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
bbd44f6c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
bitstream.c
libavcodec/bitstream.c
+17
-6
No files found.
libavcodec/bitstream.c
View file @
4b6869d6
...
...
@@ -270,11 +270,24 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
vlc
->
bits
=
nb_bits
;
if
(
flags
&
INIT_VLC_USE_NEW_STATIC
){
if
(
vlc
->
table_size
&&
vlc
->
table_size
==
vlc
->
table_allocated
){
VLC
dyn_vlc
=
*
vlc
;
if
(
vlc
->
table_size
)
return
0
;
ret
=
ff_init_vlc_sparse
(
&
dyn_vlc
,
nb_bits
,
nb_codes
,
bits
,
bits_wrap
,
bits_size
,
codes
,
codes_wrap
,
codes_size
,
symbols
,
symbols_wrap
,
symbols_size
,
flags
&
~
INIT_VLC_USE_NEW_STATIC
);
av_assert0
(
ret
>=
0
);
av_assert0
(
dyn_vlc
.
table_size
<=
vlc
->
table_allocated
);
if
(
dyn_vlc
.
table_size
<
vlc
->
table_allocated
)
av_log
(
NULL
,
AV_LOG_ERROR
,
"needed %d had %d
\n
"
,
dyn_vlc
.
table_size
,
vlc
->
table_allocated
);
memcpy
(
vlc
->
table
,
dyn_vlc
.
table
,
dyn_vlc
.
table_size
*
sizeof
(
*
vlc
->
table
));
vlc
->
table_size
=
dyn_vlc
.
table_size
;
ff_free_vlc
(
&
dyn_vlc
);
return
0
;
}
else
if
(
vlc
->
table_size
){
abort
();
// fatal error, we are called on a partially initialized table
}
}
else
{
vlc
->
table
=
NULL
;
vlc
->
table_allocated
=
0
;
...
...
@@ -316,8 +329,6 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
av_freep
(
&
vlc
->
table
);
return
-
1
;
}
if
((
flags
&
INIT_VLC_USE_NEW_STATIC
)
&&
vlc
->
table_size
!=
vlc
->
table_allocated
)
av_log
(
NULL
,
AV_LOG_ERROR
,
"needed %d had %d
\n
"
,
vlc
->
table_size
,
vlc
->
table_allocated
);
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment