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
d4e25d21
Commit
d4e25d21
authored
Jan 18, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch MMS to poll to avoid select() issues. Needs review/testing.
parent
ca779020
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
23 deletions
+17
-23
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+17
-23
No files found.
modules/access/mms/mmstu.c
View file @
d4e25d21
...
...
@@ -47,6 +47,7 @@
#endif
#include <vlc_network.h>
#include <poll.h>
#include "vlc_url.h"
#include "asf.h"
#include "buffer.h"
...
...
@@ -967,14 +968,13 @@ static int NetFillBuffer( access_t *p_access )
#else
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
struct
timeval
timeout
;
fd_set
fds_r
,
fds_e
;
int
i_ret
;
struct
pollfd
ufd
[
2
];
unsigned
timeout
,
nfd
;
/* FIXME when using udp */
ssize_t
i_tcp
,
i_udp
;
ssize_t
i_tcp_read
,
i_udp_read
;
int
i_handle_max
;
int
i_try
=
0
;
i_tcp
=
MMS_BUFFER_SIZE
/
2
-
p_sys
->
i_buffer_tcp
;
...
...
@@ -988,14 +988,7 @@ static int NetFillBuffer( access_t *p_access )
i_udp
=
0
;
/* there isn't udp socket */
}
i_handle_max
=
0
;
if
(
i_tcp
>
0
)
i_handle_max
=
__MAX
(
i_handle_max
,
p_sys
->
i_handle_tcp
);
if
(
i_udp
>
0
)
i_handle_max
=
__MAX
(
i_handle_max
,
p_sys
->
i_handle_udp
);
if
(
i_handle_max
==
0
)
if
(
(
i_udp
<=
0
)
&&
(
i_tcp
<=
0
)
)
{
msg_Warn
(
p_access
,
"nothing to read %d:%d"
,
(
int
)
i_tcp
,
(
int
)
i_udp
);
return
0
;
...
...
@@ -1011,23 +1004,24 @@ static int NetFillBuffer( access_t *p_access )
i_try
++
;
/* Initialize file descriptor set */
FD_ZERO
(
&
fds_r
);
FD_ZERO
(
&
fds_e
)
;
memset
(
ufd
,
0
,
sizeof
(
ufd
)
);
nfd
=
0
;
if
(
i_tcp
>
0
)
{
FD_SET
(
p_sys
->
i_handle_tcp
,
&
fds_r
);
FD_SET
(
p_sys
->
i_handle_tcp
,
&
fds_e
);
ufd
[
nfd
].
fd
=
p_sys
->
i_handle_tcp
;
ufd
[
nfd
].
events
=
POLLIN
;
nfd
++
;
}
if
(
i_udp
>
0
)
{
FD_SET
(
p_sys
->
i_handle_udp
,
&
fds_r
);
FD_SET
(
p_sys
->
i_handle_udp
,
&
fds_e
);
ufd
[
nfd
].
fd
=
p_sys
->
i_handle_tcp
;
ufd
[
nfd
].
events
=
POLLIN
;
nfd
++
;
}
/* We'll wait 0.5 second if nothing happens */
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
500000
;
timeout
=
500
;
if
(
i_try
>
3
&&
(
p_sys
->
i_buffer_tcp
>
0
||
p_sys
->
i_buffer_udp
>
0
)
)
{
...
...
@@ -1038,18 +1032,18 @@ static int NetFillBuffer( access_t *p_access )
//msg_Dbg( p_access, "NetFillBuffer: trying again (select)" );
}
while
(
!
(
i_ret
=
select
(
i_handle_max
+
1
,
&
fds_r
,
0
,
&
fds_e
,
&
timeout
))
||
}
while
(
!
(
i_ret
=
poll
(
ufd
,
nfd
,
timeout
))
||
(
i_ret
<
0
&&
errno
==
EINTR
)
);
if
(
i_ret
<
0
)
{
msg_Err
(
p_access
,
"network
select
error (%m)"
);
msg_Err
(
p_access
,
"network
poll
error (%m)"
);
return
-
1
;
}
i_tcp_read
=
i_udp_read
=
0
;
if
(
i_tcp
>
0
&&
FD_ISSET
(
p_sys
->
i_handle_tcp
,
&
fds_r
)
)
if
(
(
i_tcp
>
0
)
&&
ufd
[
0
].
revents
)
{
i_tcp_read
=
recv
(
p_sys
->
i_handle_tcp
,
...
...
@@ -1057,7 +1051,7 @@ static int NetFillBuffer( access_t *p_access )
i_tcp
+
MMS_BUFFER_SIZE
/
2
,
0
);
}
if
(
i_udp
>
0
&&
FD_ISSET
(
p_sys
->
i_handle_udp
,
&
fds_r
)
)
if
(
i_udp
>
0
&&
ufd
[
i_tcp
>
0
].
revents
)
{
i_udp_read
=
recv
(
p_sys
->
i_handle_udp
,
p_sys
->
buffer_udp
+
p_sys
->
i_buffer_udp
,
...
...
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