Skip to content

Commit 8e63e7f

Browse files
author
Clement Champetier
committed
VideoProperties: throw a runtime if the GOP size is invalid when decoding
So no need to check this attribute in other method.
1 parent 0588177 commit 8e63e7f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/AvTranscoder/properties/VideoProperties.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@ size_t VideoProperties::getBitRate() const
334334
return 0;
335335
}
336336

337-
if(getGopSize() <= 0)
338-
return 0;
339-
340337
LOG_INFO("Estimate the video bitrate from the first GOP.")
341338
size_t gopFramesSize = 0;
342339
for(size_t picture = 0; picture < _gopStructure.size(); ++picture)
@@ -562,6 +559,12 @@ void VideoProperties::analyseGopStructure(IProgress& progress)
562559

563560
// Returns at the beginning of the stream
564561
const_cast<FormatContext*>(&_fileProperties->getFormatContext())->seek(0, AVSEEK_FLAG_BYTE);
562+
563+
// Check GOP size
564+
if(_gopSize <= 0)
565+
{
566+
throw std::runtime_error("Invalid GOP size when decoding the first data.");
567+
}
565568
}
566569
}
567570
}

0 commit comments

Comments
 (0)