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
0326005e
Commit
0326005e
authored
Oct 01, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lazy allocation of the stat structure
Update stats in the input threads instead of playlist thread
parent
05aad79a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
29 deletions
+52
-29
include/main.h
include/main.h
+1
-1
include/vlc_input.h
include/vlc_input.h
+8
-7
include/vlc_playlist.h
include/vlc_playlist.h
+2
-0
src/input/input.c
src/input/input.c
+40
-1
src/playlist/thread.c
src/playlist/thread.c
+1
-20
No files found.
include/main.h
View file @
0326005e
include/vlc_input.h
View file @
0326005e
...
...
@@ -104,9 +104,8 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
p_i
->
i_type
=
ITEM_TYPE_UNKNOWN
;
p_i
->
b_fixed_name
=
VLC_TRUE
;
p_i
->
p_stats
=
(
input_stats_t
*
)
malloc
(
sizeof
(
input_stats_t
)
)
;
p_i
->
p_stats
=
NULL
;
p_i
->
p_meta
=
NULL
;
vlc_mutex_init
(
p_o
,
&
p_i
->
p_stats
->
lock
);
vlc_mutex_init
(
p_o
,
&
p_i
->
lock
);
}
...
...
@@ -131,11 +130,13 @@ VLC_EXPORT( void, input_ItemAddOptionNoDup,( input_item_t *, const char * ) );
static
inline
void
input_ItemClean
(
input_item_t
*
p_i
)
{
if
(
p_i
->
psz_name
)
free
(
p_i
->
psz_name
);
if
(
p_i
->
psz_uri
)
free
(
p_i
->
psz_uri
);
if
(
p_i
->
p_stats
)
free
(
p_i
->
p_stats
);
p_i
->
psz_name
=
0
;
p_i
->
psz_uri
=
0
;
free
(
p_i
->
psz_name
);
free
(
p_i
->
psz_uri
);
if
(
p_i
->
p_stats
)
{
vlc_mutex_destroy
(
&
p_i
->
p_stats
->
lock
);
free
(
p_i
->
p_stats
);
}
if
(
p_i
->
p_meta
)
vlc_meta_Delete
(
p_i
->
p_meta
);
...
...
include/vlc_playlist.h
View file @
0326005e
...
...
@@ -173,6 +173,8 @@ struct playlist_t
// Playlist-unrelated fields
interaction_t
*
p_interaction
;
/**< Interaction manager */
/** The input thread computing stats */
input_thread_t
*
p_stats_computer
;
global_stats_t
*
p_stats
;
/**< Global statistics */
/*@}*/
};
...
...
src/input/input.c
View file @
0326005e
...
...
@@ -120,6 +120,19 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
msg_Err
(
p_parent
,
"out of memory"
);
return
NULL
;
}
/* One "randomly" selected input thread is responsible for computing
* the global stats. Check if there is already someone doing this */
if
(
p_input
->
p_libvlc
->
p_playlist
->
p_stats
&&
!
b_quick
)
{
vlc_mutex_lock
(
&
p_input
->
p_libvlc
->
p_playlist
->
p_stats
->
lock
);
if
(
p_input
->
p_libvlc
->
p_playlist
->
p_stats_computer
==
NULL
)
{
p_input
->
p_libvlc
->
p_playlist
->
p_stats_computer
=
p_input
;
}
vlc_mutex_unlock
(
&
p_input
->
p_libvlc
->
p_playlist
->
p_stats
->
lock
);
}
p_input
->
b_preparsing
=
b_quick
;
p_input
->
psz_header
=
psz_header
?
strdup
(
psz_header
)
:
NULL
;
...
...
@@ -157,7 +170,13 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
if
(
!
p_input
->
input
.
p_item
->
p_meta
)
p_input
->
input
.
p_item
->
p_meta
=
vlc_meta_New
();
if
(
!
p_item
->
p_stats
)
{
p_item
->
p_stats
=
(
input_stats_t
*
)
malloc
(
sizeof
(
input_stats_t
)
);
vlc_mutex_init
(
p_input
,
&
p_item
->
p_stats
->
lock
);
stats_ReinitInputStats
(
p_item
->
p_stats
);
}
/* No slave */
p_input
->
i_slave
=
0
;
...
...
@@ -515,6 +534,7 @@ static int RunAndClean( input_thread_t *p_input )
static
void
MainLoop
(
input_thread_t
*
p_input
)
{
int64_t
i_intf_update
=
0
;
int
i_updates
=
0
;
while
(
!
p_input
->
b_die
&&
!
p_input
->
b_error
&&
!
p_input
->
input
.
b_eof
)
{
vlc_bool_t
b_force_update
=
VLC_FALSE
;
...
...
@@ -662,6 +682,17 @@ static void MainLoop( input_thread_t *p_input )
var_SetBool
(
p_input
,
"intf-change"
,
VLC_TRUE
);
i_intf_update
=
mdate
()
+
I64C
(
150000
);
}
/* 150ms * 8 = ~ 1 second */
if
(
++
i_updates
%
8
==
0
)
{
stats_ComputeInputStats
(
p_input
,
p_input
->
input
.
p_item
->
p_stats
);
/* Are we the thread responsible for computing global stats ? */
if
(
p_input
->
p_libvlc
->
p_playlist
->
p_stats_computer
==
p_input
)
{
stats_ComputeGlobalStats
(
p_input
->
p_libvlc
->
p_playlist
,
p_input
->
p_libvlc
->
p_playlist
->
p_stats
);
}
}
}
}
...
...
@@ -1119,6 +1150,14 @@ static void End( input_thread_t * p_input )
#define CL_CO( c ) stats_CounterClean( p_input->counters.p_##c ); p_input->counters.p_##c = NULL;
if
(
p_input
->
p_libvlc
->
b_stats
)
{
/* make sure we are up to date */
stats_ComputeInputStats
(
p_input
,
p_input
->
input
.
p_item
->
p_stats
);
if
(
p_input
->
p_libvlc
->
p_playlist
->
p_stats_computer
==
p_input
)
{
stats_ComputeGlobalStats
(
p_input
->
p_libvlc
->
p_playlist
,
p_input
->
p_libvlc
->
p_playlist
->
p_stats
);
p_input
->
p_libvlc
->
p_playlist
->
p_stats_computer
=
NULL
;
}
vlc_mutex_lock
(
&
p_input
->
counters
.
counters_lock
);
CL_CO
(
read_bytes
);
CL_CO
(
read_packets
);
...
...
src/playlist/thread.c
View file @
0326005e
...
...
@@ -40,8 +40,6 @@ static void HandlePlaylist( playlist_t * );
static
void
EndPlaylist
(
playlist_t
*
);
static
void
DestroyPlaylist
(
playlist_t
*
);
static
void
HandleStats
(
playlist_t
*
,
int
);
static
void
HandleInteraction
(
playlist_t
*
);
static
void
DestroyInteraction
(
playlist_t
*
);
...
...
@@ -68,6 +66,7 @@ void __playlist_ThreadCreate( vlc_object_t *p_parent )
// Stats
p_playlist
->
p_stats
=
(
global_stats_t
*
)
malloc
(
sizeof
(
global_stats_t
)
);
vlc_mutex_init
(
p_playlist
,
&
p_playlist
->
p_stats
->
lock
);
p_playlist
->
p_stats_computer
=
NULL
;
// Interaction
p_playlist
->
p_interaction
=
NULL
;
...
...
@@ -169,7 +168,6 @@ static void RunControlThread ( playlist_t *p_playlist )
i_loops
++
;
HandleInteraction
(
p_playlist
);
HandleStats
(
p_playlist
,
i_loops
);
HandlePlaylist
(
p_playlist
);
/* 100 ms is an acceptable delay for playlist operations */
...
...
@@ -247,20 +245,3 @@ static void HandleInteraction( playlist_t *p_playlist )
stats_TimerStop
(
p_playlist
,
STATS_TIMER_INTERACTION
);
}
}
/*****************************************************************************
* Stats functions
*****************************************************************************/
static
void
HandleStats
(
playlist_t
*
p_playlist
,
int
i_loops
)
{
if
(
i_loops
%
5
==
0
&&
p_playlist
->
p_stats
)
{
stats_ComputeGlobalStats
(
p_playlist
,
p_playlist
->
p_stats
);
if
(
p_playlist
->
p_input
)
{
stats_ComputeInputStats
(
p_playlist
->
p_input
,
p_playlist
->
p_input
->
input
.
p_item
->
p_stats
);
}
}
}
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