Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
2223a9a1
Commit
2223a9a1
authored
Jun 25, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix atomics usage in C++
parent
41740ba5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
modules/access/decklink.cpp
modules/access/decklink.cpp
+4
-4
modules/video_filter/atmo/atmo.cpp
modules/video_filter/atmo/atmo.cpp
+5
-5
No files found.
modules/access/decklink.cpp
View file @
2223a9a1
...
@@ -213,19 +213,19 @@ class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
...
@@ -213,19 +213,19 @@ class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
public:
public:
DeckLinkCaptureDelegate
(
demux_t
*
demux
)
:
demux_
(
demux
)
DeckLinkCaptureDelegate
(
demux_t
*
demux
)
:
demux_
(
demux
)
{
{
atomic_store
(
&
m_ref_
,
1
);
m_ref_
.
store
(
1
);
}
}
virtual
HRESULT
STDMETHODCALLTYPE
QueryInterface
(
REFIID
,
LPVOID
*
)
{
return
E_NOINTERFACE
;
}
virtual
HRESULT
STDMETHODCALLTYPE
QueryInterface
(
REFIID
,
LPVOID
*
)
{
return
E_NOINTERFACE
;
}
virtual
ULONG
STDMETHODCALLTYPE
AddRef
(
void
)
virtual
ULONG
STDMETHODCALLTYPE
AddRef
(
void
)
{
{
return
atomic_fetch_add
(
&
m_ref_
,
1
);
return
m_ref_
.
fetch_add
(
1
);
}
}
virtual
ULONG
STDMETHODCALLTYPE
Release
(
void
)
virtual
ULONG
STDMETHODCALLTYPE
Release
(
void
)
{
{
uintptr_t
new_ref
=
atomic_fetch_sub
(
&
m_ref_
,
1
);
uintptr_t
new_ref
=
m_ref_
.
fetch_sub
(
1
);
if
(
new_ref
==
0
)
if
(
new_ref
==
0
)
delete
this
;
delete
this
;
return
new_ref
;
return
new_ref
;
...
@@ -264,7 +264,7 @@ public:
...
@@ -264,7 +264,7 @@ public:
virtual
HRESULT
STDMETHODCALLTYPE
VideoInputFrameArrived
(
IDeckLinkVideoInputFrame
*
,
IDeckLinkAudioInputPacket
*
);
virtual
HRESULT
STDMETHODCALLTYPE
VideoInputFrameArrived
(
IDeckLinkVideoInputFrame
*
,
IDeckLinkAudioInputPacket
*
);
private:
private:
atomic_uint
m_ref_
;
std
::
atomic_uint
m_ref_
;
demux_t
*
demux_
;
demux_t
*
demux_
;
};
};
...
...
modules/video_filter/atmo/atmo.cpp
View file @
2223a9a1
...
@@ -695,7 +695,7 @@ typedef struct
...
@@ -695,7 +695,7 @@ typedef struct
{
{
filter_t
*
p_filter
;
filter_t
*
p_filter
;
vlc_thread_t
thread
;
vlc_thread_t
thread
;
atomic_bool
abort
;
std
::
atomic_bool
abort
;
/* tell the thread which color should be the target of fading */
/* tell the thread which color should be the target of fading */
uint8_t
ui_red
;
uint8_t
ui_red
;
...
@@ -1105,7 +1105,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
...
@@ -1105,7 +1105,7 @@ static void Atmo_Shutdown(filter_t *p_filter)
p_sys
->
p_fadethread
->
i_steps
=
1
;
p_sys
->
p_fadethread
->
i_steps
=
1
;
else
else
p_sys
->
p_fadethread
->
i_steps
=
p_sys
->
i_endfadesteps
;
p_sys
->
p_fadethread
->
i_steps
=
p_sys
->
i_endfadesteps
;
atomic_store
(
&
p_sys
->
p_fadethread
->
abort
,
false
);
p_sys
->
p_fadethread
->
abort
.
store
(
false
);
if
(
vlc_clone
(
&
p_sys
->
p_fadethread
->
thread
,
if
(
vlc_clone
(
&
p_sys
->
p_fadethread
->
thread
,
FadeToColorThread
,
FadeToColorThread
,
...
@@ -2347,7 +2347,7 @@ static void *FadeToColorThread(void *obj)
...
@@ -2347,7 +2347,7 @@ static void *FadeToColorThread(void *obj)
/* send the same pixel data again... to unlock the buffer! */
/* send the same pixel data again... to unlock the buffer! */
AtmoSendPixelData
(
p_fadethread
->
p_filter
);
AtmoSendPixelData
(
p_fadethread
->
p_filter
);
while
(
(
!
atomic_load
(
&
p_fadethread
->
abort
)
)
&&
while
(
!
p_fadethread
->
abort
.
load
(
)
&&
(
i_steps_done
<
p_fadethread
->
i_steps
))
(
i_steps_done
<
p_fadethread
->
i_steps
))
{
{
p_transfer
=
AtmoLockTransferBuffer
(
p_fadethread
->
p_filter
);
p_transfer
=
AtmoLockTransferBuffer
(
p_fadethread
->
p_filter
);
...
@@ -2360,7 +2360,7 @@ static void *FadeToColorThread(void *obj)
...
@@ -2360,7 +2360,7 @@ static void *FadeToColorThread(void *obj)
thread improvements wellcome!
thread improvements wellcome!
*/
*/
for
(
i_index
=
0
;
for
(
i_index
=
0
;
(
i_index
<
i_size
)
&&
(
!
atomic_load
(
&
p_fadethread
->
abort
)
);
(
i_index
<
i_size
)
&&
!
p_fadethread
->
abort
.
load
(
);
i_index
+=
4
)
i_index
+=
4
)
{
{
i_src_blue
=
p_source
[
i_index
+
0
];
i_src_blue
=
p_source
[
i_index
+
0
];
...
@@ -2416,7 +2416,7 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
...
@@ -2416,7 +2416,7 @@ static void CheckAndStopFadeThread(filter_t *p_filter)
{
{
msg_Dbg
(
p_filter
,
"kill still running fadeing thread..."
);
msg_Dbg
(
p_filter
,
"kill still running fadeing thread..."
);
atomic_store
(
&
p_sys
->
p_fadethread
->
abort
,
true
);
p_sys
->
p_fadethread
->
abort
.
store
(
true
);
vlc_join
(
p_sys
->
p_fadethread
->
thread
,
NULL
);
vlc_join
(
p_sys
->
p_fadethread
->
thread
,
NULL
);
free
(
p_sys
->
p_fadethread
);
free
(
p_sys
->
p_fadethread
);
...
...
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