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
3425b2e6
Commit
3425b2e6
authored
May 17, 2002
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./src/misc/mtime.c: we use nanosleep whenever possible (patch from Meuuh).
parent
815d5642
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11988 additions
and
5464 deletions
+11988
-5464
configure
configure
+11637
-5185
configure.in
configure.in
+15
-5
include/config.h
include/config.h
+7
-7
include/defs.h.in
include/defs.h.in
+290
-261
src/misc/mtime.c
src/misc/mtime.c
+39
-6
No files found.
configure
View file @
3425b2e6
This diff is collapsed.
Click to expand it.
configure.in
View file @
3425b2e6
...
...
@@ -111,7 +111,7 @@ dnl The -DSYS_FOO flag
save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"
dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty
usleep
vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2)
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2)
AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect,
...
...
@@ -124,10 +124,12 @@ AC_CHECK_FUNC(gethostbyname,,[
AC_CHECK_FUNC(gethostbyname,,[
AC_CHECK_LIB(bind,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind")
])
AC_CHECK_FUNC(nanosleep,,[
AC_CHECK_LIB(rt,nanosleep,vlc_LDFLAGS="${vlc_LDFLAGS} -lrt",[
AC_CHECK_LIB(posix4,nanosleep,vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4")
])
AC_CHECK_FUNCS(nanosleep,,[
AC_CHECK_LIB(rt,nanosleep,
[vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"],
[AC_CHECK_LIB(posix4,nanosleep,
[vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4"])]
)
])
AC_CHECK_FUNC(inet_aton,,[
AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
...
...
@@ -193,6 +195,14 @@ AC_CHECK_HEADERS(linux/version.h)
AC_HEADER_TIME
dnl Mac OS X and other OSes don't have declaration for nanosleep
dnl This only works with autoconf 2.52
AC_CHECK_DECLS(nanosleep)
dnl Make sure we have timespecs
dnl This only works with autoconf 2.52
AC_CHECK_TYPES(struct timespec)
dnl Check for threads library
AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
...
...
include/config.h
View file @
3425b2e6
...
...
@@ -41,7 +41,7 @@
/* When creating or destroying threads in blocking mode, delay to poll thread
* status */
#define THREAD_SLEEP ((
in
t)(0.010*CLOCK_FREQ))
#define THREAD_SLEEP ((
mtime_
t)(0.010*CLOCK_FREQ))
/* When a thread waits on a condition in debug mode, delay to wait before
* outputting an error message (in second) */
...
...
@@ -62,7 +62,7 @@
*****************************************************************************/
/* Base delay in micro second for interface sleeps */
#define INTF_IDLE_SLEEP ((
in
t)(0.050*CLOCK_FREQ))
#define INTF_IDLE_SLEEP ((
mtime_
t)(0.050*CLOCK_FREQ))
/* Step for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_STEP .1
...
...
@@ -73,7 +73,7 @@
*****************************************************************************/
/* XXX?? */
#define INPUT_IDLE_SLEEP ((
in
t)(0.100*CLOCK_FREQ))
#define INPUT_IDLE_SLEEP ((
mtime_
t)(0.100*CLOCK_FREQ))
/*
* General limitations
...
...
@@ -204,13 +204,13 @@
#define VOUT_FPS_SAMPLES 20
/* Better be in advance when awakening than late... */
#define VOUT_MWAIT_TOLERANCE ((
in
t)(0.020*CLOCK_FREQ))
#define VOUT_MWAIT_TOLERANCE ((
mtime_
t)(0.020*CLOCK_FREQ))
/* Time to sleep when waiting for a buffer (from vout or the video fifo).
* It should be approximately the time needed to perform a complete picture
* loop. Since it only happens when the video heap is full, it does not need
* to be too low, even if it blocks the decoder. */
#define VOUT_OUTMEM_SLEEP ((
in
t)(0.020*CLOCK_FREQ))
#define VOUT_OUTMEM_SLEEP ((
mtime_
t)(0.020*CLOCK_FREQ))
/* The default video output window title */
#define VOUT_TITLE "VideoLAN Client " VERSION
...
...
@@ -219,7 +219,7 @@
* Video parser configuration
*****************************************************************************/
#define VPAR_IDLE_SLEEP ((
in
t)(0.010*CLOCK_FREQ))
#define VPAR_IDLE_SLEEP ((
mtime_
t)(0.010*CLOCK_FREQ))
/* Optimization level, from 0 to 2 - 1 is generally a good compromise. Remember
* that raising this level dramatically lengthens the compilation time. */
...
...
@@ -236,7 +236,7 @@
* Video decoder configuration
*****************************************************************************/
#define VDEC_IDLE_SLEEP ((
in
t)(0.100*CLOCK_FREQ))
#define VDEC_IDLE_SLEEP ((
mtime_
t)(0.100*CLOCK_FREQ))
/* Maximum range of values out of the IDCT + motion compensation. */
#define VDEC_CROPRANGE 2048
...
...
include/defs.h.in
View file @
3425b2e6
This diff is collapsed.
Click to expand it.
src/misc/mtime.c
View file @
3425b2e6
...
...
@@ -3,7 +3,7 @@
* Functions are prototyped in mtime.h.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: mtime.c,v 1.
29 2002/05/17 15:14:47 lool
Exp $
* $Id: mtime.c,v 1.
30 2002/05/17 16:38:41 sam
Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
...
...
@@ -52,6 +52,18 @@
# include <sys/time.h>
#endif
#if defined(HAVE_NANOSLEEP) && !defined(HAVE_STRUCT_TIMESPEC)
struct
timespec
{
time_t
tv_sec
;
long
tv_sec
;
};
#endif
#if defined(HAVE_NANOSLEEP) && !defined(HAVE_DECL_NANOSLEEP)
int
nanosleep
(
struct
timespec
*
,
struct
timespec
*
);
#endif
/*****************************************************************************
* mstrtime: return a date in a readable format
*****************************************************************************
...
...
@@ -141,7 +153,7 @@ void mwait( mtime_t date )
#else
struct
timeval
tv_date
,
tv_delay
;
struct
timeval
tv_date
;
mtime_t
delay
;
/* delay in msec, signed to detect errors */
/* see mdate() about gettimeofday() possible errors */
...
...
@@ -166,10 +178,22 @@ void mwait( mtime_t date )
st_usleep
(
delay
);
# else
tv_delay
.
tv_sec
=
delay
/
1000000
;
tv_delay
.
tv_usec
=
delay
%
1000000
;
# if defined( HAVE_NANOSLEEP )
{
struct
timespec
ts_delay
;
ts_delay
.
tv_sec
=
delay
/
1000000
;
ts_delay
.
tv_nsec
=
(
delay
%
1000000
)
*
1000
;
nanosleep
(
&
ts_delay
,
NULL
);
}
# else
tv_date
.
tv_sec
=
delay
/
1000000
;
tv_date
.
tv_usec
=
delay
%
1000000
;
/* see msleep() about select() errors */
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv_delay
);
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv_date
);
# endif
# endif
...
...
@@ -195,15 +219,24 @@ void msleep( mtime_t delay )
#elif defined( WIN32 )
Sleep
(
(
int
)
(
delay
/
1000
)
);
#elif defined( HAVE_NANOSLEEP )
struct
timespec
ts_delay
;
ts_delay
.
tv_sec
=
delay
/
1000000
;
ts_delay
.
tv_nsec
=
(
delay
%
1000000
)
*
1000
;
nanosleep
(
&
ts_delay
,
NULL
);
#else
struct
timeval
tv_delay
;
tv_delay
.
tv_sec
=
delay
/
1000000
;
tv_delay
.
tv_usec
=
delay
%
1000000
;
/* select() return value should be tested, since several possible errors
* can occur. However, they should only happen in very particular occasions
* (i.e. when a signal is sent to the thread, or when memory is full), and
* can be i
n
gnored. */
* can be ignored. */
select
(
0
,
NULL
,
NULL
,
NULL
,
&
tv_delay
);
#endif
...
...
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