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
a5e3a954
Commit
a5e3a954
authored
Nov 09, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vout: use atomic variables for stats instead of spin lock
parent
9b925e51
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
src/video_output/statistic.h
src/video_output/statistic.h
+22
-18
src/video_output/video_output.c
src/video_output/video_output.c
+2
-2
No files found.
src/video_output/statistic.h
View file @
a5e3a954
...
@@ -22,39 +22,43 @@
...
@@ -22,39 +22,43 @@
*****************************************************************************/
*****************************************************************************/
#ifndef LIBVLC_VOUT_STATISTIC_H
#ifndef LIBVLC_VOUT_STATISTIC_H
#define LIBVLC_VOUT_STATISTIC_H
# define LIBVLC_VOUT_STATISTIC_H
# include <vlc_atomic.h>
/* NOTE: Both statistics are atomic on their own, so one might be older than
* the other one. Currently, only one of them is updated at a time, so this
* is a non-issue. */
typedef
struct
{
typedef
struct
{
vlc_spinlock_t
spin
;
atomic_uint
displayed
;
atomic_uint
lost
;
int
displayed
;
int
lost
;
}
vout_statistic_t
;
}
vout_statistic_t
;
static
inline
void
vout_statistic_Init
(
vout_statistic_t
*
stat
)
static
inline
void
vout_statistic_Init
(
vout_statistic_t
*
stat
)
{
{
vlc_spin_init
(
&
stat
->
spin
);
atomic_init
(
&
stat
->
displayed
,
0
);
atomic_init
(
&
stat
->
lost
,
0
);
}
}
static
inline
void
vout_statistic_Clean
(
vout_statistic_t
*
stat
)
static
inline
void
vout_statistic_Clean
(
vout_statistic_t
*
stat
)
{
{
vlc_spin_destroy
(
&
stat
->
spin
)
;
(
void
)
stat
;
}
}
static
inline
void
vout_statistic_GetReset
(
vout_statistic_t
*
stat
,
int
*
displayed
,
int
*
lost
)
static
inline
void
vout_statistic_GetReset
(
vout_statistic_t
*
stat
,
int
*
displayed
,
int
*
lost
)
{
{
vlc_spin_lock
(
&
stat
->
spin
);
*
displayed
=
atomic_exchange
(
&
stat
->
displayed
,
0
);
*
displayed
=
stat
->
displayed
;
*
lost
=
atomic_exchange
(
&
stat
->
lost
,
0
)
;
*
lost
=
stat
->
lost
;
}
stat
->
displayed
=
0
;
static
inline
void
vout_statistic_AddDisplayed
(
vout_statistic_t
*
stat
,
stat
->
lost
=
0
;
int
displayed
)
vlc_spin_unlock
(
&
stat
->
spin
);
{
atomic_fetch_add
(
&
stat
->
displayed
,
displayed
);
}
}
static
inline
void
vout_statistic_Update
(
vout_statistic_t
*
stat
,
int
displayed
,
int
lost
)
static
inline
void
vout_statistic_AddLost
(
vout_statistic_t
*
stat
,
int
lost
)
{
{
vlc_spin_lock
(
&
stat
->
spin
);
atomic_fetch_add
(
&
stat
->
lost
,
lost
);
stat
->
displayed
+=
displayed
;
stat
->
lost
+=
lost
;
vlc_spin_unlock
(
&
stat
->
spin
);
}
}
#endif
#endif
src/video_output/video_output.c
View file @
a5e3a954
...
@@ -862,7 +862,7 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool is_
...
@@ -862,7 +862,7 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool is_
vlc_mutex_unlock
(
&
vout
->
p
->
filter
.
lock
);
vlc_mutex_unlock
(
&
vout
->
p
->
filter
.
lock
);
vout_statistic_
Update
(
&
vout
->
p
->
statistic
,
0
,
lost_count
);
vout_statistic_
AddLost
(
&
vout
->
p
->
statistic
,
lost_count
);
if
(
!
picture
)
if
(
!
picture
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -1056,7 +1056,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
...
@@ -1056,7 +1056,7 @@ static int ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
subpic
);
subpic
);
sys
->
display
.
filtered
=
NULL
;
sys
->
display
.
filtered
=
NULL
;
vout_statistic_
Update
(
&
vout
->
p
->
statistic
,
1
,
0
);
vout_statistic_
AddDisplayed
(
&
vout
->
p
->
statistic
,
1
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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