From 7fb0e68cabb0a438f156b938e0795d936fdbefc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CC=A6tefan=20Sa=CC=86ftescu?= Date: Fri, 22 Jan 2021 15:47:21 +0200 Subject: [PATCH] Replace hardcoded error code with ENODATA The video reader suppressed code 61 (ENODATA on Linux) that occured at the end of a stream and logged an INFO message. On macOS ENODATA has a different code (96), which resulted in an error message being logged. This small patch replaces the hard-coded value with the ENODATA constant to suppress the macOS warning. --- torchvision/csrc/io/video/Video.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchvision/csrc/io/video/Video.cpp b/torchvision/csrc/io/video/Video.cpp index 9a995c23e6c..c1e19e0b5f5 100644 --- a/torchvision/csrc/io/video/Video.cpp +++ b/torchvision/csrc/io/video/Video.cpp @@ -311,8 +311,8 @@ std::tuple Video::Next() { // currently not supporting other formats (will do soon) out.payload.reset(); - } else if (res == 61) { - LOG(INFO) << "Decoder ran out of frames (error 61)\n"; + } else if (res == ENODATA) { + LOG(INFO) << "Decoder ran out of frames (ENODATA)\n"; } else { LOG(ERROR) << "Decoder failed with ERROR_CODE " << res; }