mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 15:52:25 +00:00
- 10l fix: it exited with return MP_INPUT_NOTHING; if all fd's have
MP_FD_NO_SELECT set! - moved time_val stuff into if(n>0), also changed misleading while(n>0) to while(1) (as the loop never touch n) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9735 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
c382b3cd47
commit
68ea3c85ba
@ -782,6 +782,7 @@ mp_input_read_key_code(int time) {
|
|||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
// Remove fd marked as dead and build the fd_set
|
// Remove fd marked as dead and build the fd_set
|
||||||
|
// n == number of fd's to be select() checked
|
||||||
for(i = 0; (unsigned int)i < num_key_fd; i++) {
|
for(i = 0; (unsigned int)i < num_key_fd; i++) {
|
||||||
if( (key_fds[i].flags & MP_FD_DEAD) ) {
|
if( (key_fds[i].flags & MP_FD_DEAD) ) {
|
||||||
mp_input_rm_key_fd(key_fds[i].fd);
|
mp_input_rm_key_fd(key_fds[i].fd);
|
||||||
@ -795,9 +796,12 @@ mp_input_read_key_code(int time) {
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n == 0 || num_key_fd == 0)
|
if(num_key_fd == 0)
|
||||||
return MP_INPUT_NOTHING;
|
return MP_INPUT_NOTHING;
|
||||||
|
|
||||||
|
// if we have fd's without MP_FD_NO_SELECT flag, call select():
|
||||||
|
if(n>0){
|
||||||
|
|
||||||
if(time >= 0 ) {
|
if(time >= 0 ) {
|
||||||
tv.tv_sec=time/1000;
|
tv.tv_sec=time/1000;
|
||||||
tv.tv_usec = (time%1000)*1000;
|
tv.tv_usec = (time%1000)*1000;
|
||||||
@ -805,7 +809,7 @@ mp_input_read_key_code(int time) {
|
|||||||
} else
|
} else
|
||||||
time_val = NULL;
|
time_val = NULL;
|
||||||
|
|
||||||
while(n > 0) {
|
while(1) {
|
||||||
if(select(max_fd+1,&fds,NULL,NULL,time_val) < 0) {
|
if(select(max_fd+1,&fds,NULL,NULL,time_val) < 0) {
|
||||||
if(errno == EINTR)
|
if(errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
@ -813,7 +817,9 @@ mp_input_read_key_code(int time) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for(i = last_loop + 1 ; i != last_loop ; i++) {
|
for(i = last_loop + 1 ; i != last_loop ; i++) {
|
||||||
int code = -1;
|
int code = -1;
|
||||||
// This is to check all fd in turn
|
// This is to check all fd in turn
|
||||||
|
Loading…
Reference in New Issue
Block a user