diff --git a/libeplayer3-arm/include/writer.h b/libeplayer3-arm/include/writer.h index cd535d9..9b7b7b5 100644 --- a/libeplayer3-arm/include/writer.h +++ b/libeplayer3-arm/include/writer.h @@ -92,5 +92,5 @@ ssize_t write_with_retry(int fd, const void *buf, int size); ssize_t writev_with_retry(int fd, const struct iovec *iov, int ic); ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf, int size); -void FlusPipe(int pipefd); +void FlushPipe(int pipefd); #endif diff --git a/libeplayer3-arm/output/writer/common/writer.c b/libeplayer3-arm/output/writer/common/writer.c index 748bf36..2447288 100644 --- a/libeplayer3-arm/output/writer/common/writer.c +++ b/libeplayer3-arm/output/writer/common/writer.c @@ -67,7 +67,7 @@ if (debug_level >= level) printf(x); } while (0) /* ***************************** */ /* Functions */ /* ***************************** */ -void FlusPipe(int pipefd) +void FlushPipe(int pipefd) { char tmp; while(1 == read(pipefd, &tmp, 1)); diff --git a/libeplayer3-arm/output/writer/mipsel/writer.c b/libeplayer3-arm/output/writer/mipsel/writer.c index 33a83ab..6154238 100644 --- a/libeplayer3-arm/output/writer/mipsel/writer.c +++ b/libeplayer3-arm/output/writer/mipsel/writer.c @@ -119,13 +119,14 @@ ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf, FD_SET(pipefd, &rfds); FD_SET(fd, &wfds); - /* When we PAUSE LINUX DVB outputs buffers then audio/video buffers - * will be filled to full unfortunately, in such case after resume - * select never return with fd set - bug in DVB drivers? - * So, there will be to workarounds: - * 1. write to pipe pipe at resume to exit select immediately - * 2. even if fd is not set exit from select after 0,1s - * (it seems that second workaround is not needed) + /* When we PAUSE LINUX DVB outputs buffers, then audio/video buffers + * will continue to be filled. Unfortunately, in such case after resume + * select() will never return with fd set - bug in DVB drivers? + * There are to workarounds possible: + * 1. write to pipe at resume to return from select() immediately + * 2. make timeout select(), limit max time spend in the select() + * to for example 0,1s + * (at now first workaround is used) */ //tv.tv_sec = 0; //tv.tv_usec = 100000; // 100ms @@ -138,13 +139,13 @@ ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf, //if (retval == 0) //{ - // //printf("RETURN FROM SELECT DUE TO TIMEOUT TIMEOUT\n"); + // //printf("RETURN FROM SELECT DUE TO TIMEOUT\n"); // continue; //} if(FD_ISSET(pipefd, &rfds)) { - FlusPipe(pipefd); + FlushPipe(pipefd); //printf("RETURN FROM SELECT DUE TO pipefd SET\n"); continue; } @@ -172,12 +173,13 @@ ssize_t WriteWithRetry(Context_t *context, int pipefd, int fd, const void *buf, } else if (ret == 0) { - //printf("This should not happen. Select return fd ready to write, but write return 0, errno [%d]\n", errno); + // printf("This should not happen. Select return fd ready to write, but write return 0, errno [%d]\n", errno); + // wait 10ms before next try tv.tv_sec = 0; tv.tv_usec = 10000; // 10ms retval = select(pipefd + 1, &rfds, NULL, NULL, &tv); if (retval) - FlusPipe(pipefd); + FlushPipe(pipefd); continue; }