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
80fb50ea
Commit
80fb50ea
authored
Oct 19, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code factorization
parent
e5ca059b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
51 deletions
+36
-51
configure.ac
configure.ac
+1
-0
src/network/io.c
src/network/io.c
+35
-51
No files found.
configure.ac
View file @
80fb50ea
...
...
@@ -772,6 +772,7 @@ fi # end "${SYS}" != "mingw32" -a "${SYS}" != "mingwce"
AC_HEADER_TIME
AC_CHECK_TYPE(ssize_t, int)
AC_SEARCH_LIBS(poll, [poll], [AC_DEFINE(HAVE_POLL, 1, [Define to 1 if the OS is usabl... err, has poll().])])
dnl Check for dirent
...
...
src/network/io.c
View file @
80fb50ea
...
...
@@ -127,7 +127,7 @@ void net_Close (int fd)
}
static
in
t
static
ssize_
t
net_ReadInner
(
vlc_object_t
*
restrict
p_this
,
unsigned
fdc
,
const
int
*
fdv
,
const
v_socket_t
*
const
*
restrict
vsv
,
uint8_t
*
restrict
p_buf
,
size_t
i_buflen
,
...
...
@@ -135,10 +135,10 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
{
size_t
i_total
=
0
;
do
while
(
i_buflen
>
0
)
{
unsigned
i
nt
i
;
int
n
,
delay_ms
;
unsigned
i
;
ssize_t
n
;
#ifdef HAVE_POLL
struct
pollfd
ufd
[
fdc
];
#else
...
...
@@ -146,21 +146,18 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
fd_set
set
;
#endif
if
(
i_buflen
==
0
)
return
i_total
;
// output buffer full
delay_ms
=
500
;
if
(
(
wait_ms
!=
-
1
)
&&
(
wait_ms
<
500
)
)
int
delay_ms
=
500
;
if
((
wait_ms
!=
-
1
)
&&
(
wait_ms
<
500
))
delay_ms
=
wait_ms
;
if
(
p_this
->
b_die
)
if
(
p_this
->
b_die
)
{
errno
=
EINTR
;
goto
error
;
}
#ifdef HAVE_POLL
memset
(
ufd
,
0
,
sizeof
(
ufd
)
);
memset
(
ufd
,
0
,
sizeof
(
ufd
)
);
for
(
i
=
0
;
i
<
fdc
;
i
++
)
{
...
...
@@ -169,25 +166,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
}
n
=
poll
(
ufd
,
fdc
,
delay_ms
);
if
(
n
==
-
1
)
goto
error
;
assert
(
(
unsigned
int
)
n
<=
fdc
);
for
(
i
=
0
;
n
>
0
;
i
++
)
{
if
(
(
i_total
>
0
)
&&
(
ufd
[
i
].
revents
&
POLLERR
)
)
return
i_total
;
// error will be dequeued on next run
if
(
ufd
[
i
].
revents
)
{
fdc
=
1
;
fdv
+=
i
;
vsv
+=
i
;
n
--
;
goto
receive
;
}
}
#else
FD_ZERO
(
&
set
);
...
...
@@ -209,23 +187,32 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
n
=
select
(
maxfd
+
1
,
&
set
,
NULL
,
NULL
,
(
wait_ms
==
-
1
)
?
NULL
:
&
(
struct
timeval
){
0
,
delay_ms
*
1000
}
);
#endif
if
(
n
==
-
1
)
goto
error
;
for
(
i
=
0
;
n
>
0
;
i
++
)
if
(
FD_ISSET
(
fdv
[
i
],
&
set
)
)
{
fdc
=
1
;
fdv
+=
i
;
vsv
+=
i
;
n
--
;
goto
receive
;
}
#endif
assert
((
unsigned
)
n
<=
fdc
);
continue
;
if
(
n
==
0
)
// timeout
continue
;
for
(
i
=
0
;;
i
++
)
{
#ifdef HAVE_POLL
if
((
i_total
>
0
)
&&
(
ufd
[
i
].
revents
&
POLLERR
))
return
i_total
;
// error will be dequeued on next run
if
((
ufd
[
i
].
revents
&
POLLIN
)
==
0
)
#else
if
(
!
FD_ISSET
(
fdv
[
i
],
&
set
))
continue
;
#endif
fdc
=
1
;
fdv
+=
i
;
vsv
+=
i
;
break
;
}
receive:
if
(
(
*
vsv
)
!=
NULL
)
{
n
=
(
*
vsv
)
->
pf_recv
(
(
*
vsv
)
->
p_sys
,
p_buf
,
i_buflen
);
...
...
@@ -272,19 +259,16 @@ receive:
p_buf
+=
n
;
i_buflen
-=
n
;
if
(
wait_ms
==
-
1
)
{
if
(
!
waitall
)
return
i_total
;
}
else
if
(
!
waitall
)
return
i_total
;
if
(
wait_ms
!=
-
1
)
{
wait_ms
-=
delay_ms
;
if
(
wait_ms
==
0
)
return
i_total
;
// time's up!
}
}
while
(
wait_ms
);
return
i_total
;
// timeout
error:
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
)
);
...
...
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