Skip to content

Commit a61d95f

Browse files
author
Clement Champetier
committed
VideoProperties: refactor how to getDuration
Else statement was not necessary!
1 parent ad44be7 commit a61d95f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/AvTranscoder/properties/VideoProperties.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -475,18 +475,16 @@ float VideoProperties::getDuration() const
475475
LOG_INFO("Need a deeper analysis: see eAnalyseLevelFirstGop.")
476476
return 0;
477477
}
478-
else
478+
479+
if(! _nbFrames)
479480
{
480-
if(! _nbFrames)
481-
{
482-
LOG_INFO("Estimate the duration from the file size and the bitrate.")
483-
const size_t bitRate = getBitRate();
484-
if(bitRate)
485-
return _fileProperties->getFileSize() / bitRate * 8;
486-
}
487-
LOG_INFO("Get the exact duration from the number of frames and the fps.")
488-
return _nbFrames / getFps();
481+
LOG_INFO("Estimate the duration from the file size and the bitrate.")
482+
const size_t bitRate = getBitRate();
483+
if(bitRate)
484+
return _fileProperties->getFileSize() / bitRate * 8;
489485
}
486+
LOG_INFO("Get the exact duration from the number of frames and the fps.")
487+
return _nbFrames / getFps();
490488
}
491489

492490
bool VideoProperties::hasBFrames() const

0 commit comments

Comments
 (0)