From 0326c320fdb82f978b83b236326cdee65fab4fef Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 16 Jan 2017 11:42:44 +0100 Subject: [PATCH] InputFile: throw a runtime_error if there is an error while reading the next packet The error has to be other than the End Of the File. --- src/AvTranscoder/file/InputFile.cpp | 11 +++++++++-- src/AvTranscoder/file/InputFile.hpp | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/AvTranscoder/file/InputFile.cpp b/src/AvTranscoder/file/InputFile.cpp index 41eb8ddb..1e951698 100644 --- a/src/AvTranscoder/file/InputFile.cpp +++ b/src/AvTranscoder/file/InputFile.cpp @@ -62,8 +62,15 @@ bool InputFile::readNextPacket(CodedData& data, const size_t streamIndex) if(ret < 0) // error or end of file { LOG_INFO("Stop reading the next frame of file '" << _filename << "', stream " << streamIndex << " (" - << getDescriptionFromErrorCode(ret) << ")") - return false; + << getDescriptionFromErrorCode(ret) << ")"); + if(ret == AVERROR_EOF) + { + LOG_INFO("There is no more data to read."); + return false; + } + + LOG_ERROR("Error while reading this stream."); + throw std::runtime_error("Error while reading this stream."); } // Add Stream info to the packet diff --git a/src/AvTranscoder/file/InputFile.hpp b/src/AvTranscoder/file/InputFile.hpp index 60423485..6b6501a1 100644 --- a/src/AvTranscoder/file/InputFile.hpp +++ b/src/AvTranscoder/file/InputFile.hpp @@ -43,7 +43,8 @@ class AvExport InputFile /** * @brief Read the next packet of the specified stream * @param data: data of next packet read - * @return if next packet was read succefully + * @return if next packet was read successfully + * @exception runtime_error launched if there is an error (other than End Of File) while reading the next packet **/ bool readNextPacket(CodedData& data, const size_t streamIndex); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy