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
cdabd50c
Commit
cdabd50c
authored
Jun 30, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvb: fix polling, do not wake up 10x per seconds
parent
025e3052
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
32 deletions
+39
-32
modules/access/dvb/access.c
modules/access/dvb/access.c
+39
-32
No files found.
modules/access/dvb/access.c
View file @
cdabd50c
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_access.h>
#include <vlc_input.h>
#include <vlc_input.h>
#include <vlc_interrupt.h>
#include <sys/types.h>
#include <sys/types.h>
#include <poll.h>
#include <poll.h>
...
@@ -251,54 +252,60 @@ static block_t *BlockScan( access_t *p_access )
...
@@ -251,54 +252,60 @@ static block_t *BlockScan( access_t *p_access )
bool
b_has_lock
=
false
;
bool
b_has_lock
=
false
;
int
i_best_snr
=
-
1
;
int
i_best_snr
=
-
1
;
for
(
;
;
)
/* Initialize file descriptor sets */
{
struct
pollfd
ufds
[
2
];
struct
pollfd
ufds
[
2
];
int
i_ret
;
/* Initialize file descriptor sets */
memset
(
ufds
,
0
,
sizeof
(
ufds
));
ufds
[
0
].
fd
=
p_sys
->
i_handle
;
ufds
[
0
].
fd
=
p_sys
->
i_handle
;
ufds
[
0
].
events
=
POLLIN
;
ufds
[
0
].
events
=
POLLIN
;
ufds
[
1
].
fd
=
p_sys
->
i_frontend_handle
;
ufds
[
1
].
fd
=
p_sys
->
i_frontend_handle
;
ufds
[
1
].
events
=
POLLPRI
;
ufds
[
1
].
events
=
POLLPRI
;
/* We'll wait 0.1 second if nothing happens */
for
(
;
;
)
/* Find if some data is available */
i_ret
=
poll
(
ufds
,
2
,
100
);
if
(
!
vlc_object_alive
(
p_access
)
||
scan_IsCancelled
(
p_scan
)
)
break
;
if
(
i_ret
<=
0
)
{
{
const
mtime_t
i_scan_time
=
mdate
()
-
i_scan_start
;
frontend_status_t
status
;
frontend_status_t
status
;
FrontendGetStatus
(
p_access
,
&
status
);
FrontendGetStatus
(
p_access
,
&
status
);
b_has_dvb_signal
|=
status
.
b_has_carrier
;
b_has_dvb_signal
|=
status
.
b_has_carrier
;
b_has_lock
|=
status
.
b_has_lock
;
b_has_lock
|=
status
.
b_has_lock
;
if
(
(
!
b_has_dvb_signal
&&
i_scan_time
>
DVB_SCAN_MAX_SIGNAL_TIME
)
||
int64_t
i_scan_end
=
i_scan_start
;
(
!
b_has_lock
&&
i_scan_time
>
DVB_SCAN_MAX_LOCK_TIME
)
||
if
(
!
b_has_dvb_signal
)
(
i_scan_time
>
DVB_SCAN_MAX_PROBE_TIME
)
)
i_scan_end
+=
DVB_SCAN_MAX_SIGNAL_TIME
;
else
if
(
!
b_has_lock
)
i_scan_end
+=
DVB_SCAN_MAX_LOCK_TIME
;
else
i_scan_end
+=
DVB_SCAN_MAX_PROBE_TIME
;
/* Find if some data is available */
int
i_ret
;
do
{
{
msg_Dbg
(
p_access
,
"timed out scanning current frequency (s=%d l=%d)"
,
b_has_dvb_signal
,
b_has_lock
);
int64_t
timeout
=
i_scan_end
-
mdate
();
i_ret
=
0
;
if
(
!
vlc_object_alive
(
p_access
)
||
scan_IsCancelled
(
p_scan
)
)
break
;
break
;
if
(
timeout
>=
0
)
i_ret
=
vlc_poll_i11e
(
ufds
,
2
,
timeout
/
1000
);
}
}
}
while
(
i_ret
<
0
&&
errno
==
EINTR
);
if
(
i_ret
<
0
)
if
(
i_ret
<
0
)
{
{
if
(
errno
==
EINTR
)
continue
;
msg_Err
(
p_access
,
"poll error: %s"
,
vlc_strerror_c
(
errno
)
);
msg_Err
(
p_access
,
"poll error: %s"
,
vlc_strerror_c
(
errno
)
);
scan_session_Destroy
(
p_scan
,
session
);
p_access
->
info
.
b_eof
=
true
;
p_access
->
info
.
b_eof
=
true
;
return
NULL
;
break
;
}
if
(
i_ret
==
0
)
{
msg_Dbg
(
p_access
,
"timed out scanning current frequency (s=%d l=%d)"
,
b_has_dvb_signal
,
b_has_lock
);
break
;
}
}
if
(
ufds
[
1
].
revents
)
if
(
ufds
[
1
].
revents
)
...
...
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