From 3a1893ba7e1e4ea5aef0f5181886defaa5e69e91 Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Wed, 8 Mar 2023 22:16:28 -0300 Subject: [PATCH] nxplayer: read file completely until 0 bytes are returned Previously, if the read bytes were less than the requested, the file was closed immediately. This behavior, however, does not consider the fact that the read operation may be blocking when no bytes are available at the moment. That is true for a named pipe (FIFO), for instance. Thus, reading it again lets to the underlying file system the decision of 1) blocking until bytes become available or 2) return 0 immediately (the case for actual files) or 3) read available bytes. --- system/nxplayer/nxplayer_common.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system/nxplayer/nxplayer_common.c b/system/nxplayer/nxplayer_common.c index f93d5aba7..47e0b288a 100644 --- a/system/nxplayer/nxplayer_common.c +++ b/system/nxplayer/nxplayer_common.c @@ -54,9 +54,6 @@ int nxplayer_fill_common(int fd, FAR struct ap_buffer_s *apb) apb->curbyte = 0; apb->flags = 0; -#ifdef CONFIG_NXPLAYER_HTTP_STREAMING_SUPPORT - /* read data up to nmaxbytes from network */ - while (0 < apb->nbytes && apb->nbytes < apb->nmaxbytes) { int n = apb->nmaxbytes - apb->nbytes; @@ -69,7 +66,6 @@ int nxplayer_fill_common(int fd, FAR struct ap_buffer_s *apb) apb->nbytes += ret; } -#endif if (apb->nbytes < apb->nmaxbytes) {