Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
d8f85cc1
Commit
d8f85cc1
authored
Aug 02, 2005
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/codec/ffmpeg: More locking around avcodec_open() and avcodec_close().
parent
5d1c2af0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
modules/codec/ffmpeg/encoder.c
modules/codec/ffmpeg/encoder.c
+13
-0
modules/codec/ffmpeg/ffmpeg.c
modules/codec/ffmpeg/ffmpeg.c
+5
-0
No files found.
modules/codec/ffmpeg/encoder.c
View file @
d8f85cc1
...
...
@@ -181,6 +181,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
int
i_codec_id
,
i_cat
;
char
*
psz_namecodec
;
vlc_value_t
val
;
vlc_value_t
lockval
;
var_Get
(
p_enc
->
p_libvlc
,
"avcodec"
,
&
lockval
);
if
(
!
E_
(
GetFfmpegCodec
)(
p_enc
->
fmt_out
.
i_codec
,
&
i_cat
,
&
i_codec_id
,
&
psz_namecodec
)
)
...
...
@@ -523,8 +526,10 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
p_context
->
extradata
=
NULL
;
p_context
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
vlc_mutex_lock
(
lockval
.
p_address
);
if
(
avcodec_open
(
p_context
,
p_codec
)
)
{
vlc_mutex_unlock
(
lockval
.
p_address
);
if
(
p_enc
->
fmt_in
.
i_cat
==
AUDIO_ES
&&
(
p_context
->
channels
>
2
||
i_codec_id
==
CODEC_ID_MP2
||
i_codec_id
==
CODEC_ID_MP3
)
)
...
...
@@ -574,8 +579,10 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
}
p_context
->
codec
=
NULL
;
vlc_mutex_lock
(
lockval
.
p_address
);
if
(
avcodec_open
(
p_context
,
p_codec
)
)
{
vlc_mutex_unlock
(
lockval
.
p_address
);
msg_Err
(
p_enc
,
"cannot open encoder"
);
free
(
p_sys
);
return
VLC_EGENERIC
;
...
...
@@ -588,6 +595,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
}
vlc_mutex_unlock
(
lockval
.
p_address
);
p_enc
->
fmt_out
.
i_extra
=
p_context
->
extradata_size
;
p_enc
->
fmt_out
.
p_extra
=
p_context
->
extradata
;
...
...
@@ -999,6 +1007,9 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
{
encoder_t
*
p_enc
=
(
encoder_t
*
)
p_this
;
encoder_sys_t
*
p_sys
=
p_enc
->
p_sys
;
vlc_value_t
lockval
;
var_Get
(
p_enc
->
p_libvlc
,
"avcodec"
,
&
lockval
);
#if LIBAVCODEC_BUILD >= 4702
if
(
p_sys
->
b_inited
&&
p_enc
->
i_threads
>=
1
)
...
...
@@ -1020,7 +1031,9 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
}
#endif
vlc_mutex_lock
(
lockval
.
p_address
);
avcodec_close
(
p_sys
->
p_context
);
vlc_mutex_unlock
(
lockval
.
p_address
);
av_free
(
p_sys
->
p_context
);
if
(
p_sys
->
p_buffer
)
free
(
p_sys
->
p_buffer
);
...
...
modules/codec/ffmpeg/ffmpeg.c
View file @
d8f85cc1
...
...
@@ -293,6 +293,9 @@ static void CloseDecoder( vlc_object_t *p_this )
{
decoder_t
*
p_dec
=
(
decoder_t
*
)
p_this
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
vlc_value_t
lockval
;
var_Get
(
p_dec
->
p_libvlc
,
"avcodec"
,
&
lockval
);
switch
(
p_sys
->
i_cat
)
{
...
...
@@ -309,7 +312,9 @@ static void CloseDecoder( vlc_object_t *p_this )
if
(
p_sys
->
p_context
->
extradata
)
free
(
p_sys
->
p_context
->
extradata
);
vlc_mutex_lock
(
lockval
.
p_address
);
avcodec_close
(
p_sys
->
p_context
);
vlc_mutex_unlock
(
lockval
.
p_address
);
msg_Dbg
(
p_dec
,
"ffmpeg codec (%s) stopped"
,
p_sys
->
psz_namecodec
);
av_free
(
p_sys
->
p_context
);
}
...
...
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