Protect video_length from being overwritten if CheckFPS overwrites it first

This commit is contained in:
Jonathan Thomas
2022-09-02 09:36:06 -05:00
parent 60805beec3
commit 5f692f18d6

View File

@@ -822,7 +822,8 @@ void FFmpegReader::UpdateVideoInfo() {
}
// Get the # of video frames (if found in stream)
if (pStream->nb_frames > 0) {
// Only set this 1 time (this method can be called multiple times)
if (pStream->nb_frames > 0 && info.video_length <= 0) {
info.video_length = pStream->nb_frames;
}
@@ -837,6 +838,7 @@ void FFmpegReader::UpdateVideoInfo() {
is_duration_known = true;
// Calculate number of frames (if not already found in metadata)
// Only set this 1 time (this method can be called multiple times)
if (info.video_length <= 0) {
info.video_length = round(info.duration * info.fps.ToDouble());
}