Skip to content

Display and control your Android device

Never return 0 for stream protocol

Romain Vimont72bdfbc7a6f0
diff --git a/app/src/stream.c b/app/src/stream.c
index 9a946375..4f38cecf 100644
--- a/app/src/stream.c
+++ b/app/src/stream.c
@@ -113,7 +113,7 @@ read_packet_with_meta(void *opaque, uint8_t *buf, int buf_size) {
ssize_t r = net_recv(stream->socket, buf, buf_size);
if (r == -1) {
- return AVERROR(errno);
+ return errno ? AVERROR(errno) : AVERROR_EOF;
}
if (r == 0) {
return AVERROR_EOF;
@@ -130,7 +130,7 @@ read_raw_packet(void *opaque, uint8_t *buf, int buf_size) {
struct stream *stream = opaque;
ssize_t r = net_recv(stream->socket, buf, buf_size);
if (r == -1) {
- return AVERROR(errno);
+ return errno ? AVERROR(errno) : AVERROR_EOF;
}
if (r == 0) {
return AVERROR_EOF;