Matroska reader: fix timestamp-based progress calculation when appending

When appending m_last_timecode is already offset by
m_first_timecode. Therefore subtracting it once more during the progress
calculation will result in negative numbers if m_first_timecode is
non-zero – which is the case when appending files created by splitting
with linking enabled, for example.
This commit is contained in:
Moritz Bunkus 2015-12-19 21:14:16 +01:00
parent ee39d23a7f
commit 9e70ebd83c
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,11 @@
2015-12-19 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: the progress calculation was sometimes
outputting negative numbers when appending Matroska files whose
timestamps don't start at 0 (e.g. if they were created by
splitting with linking enabled). In the the GUI this resulted in
lines like "#GUI#progress -2%" in the job's output.
* mkvpropedit: new feature: added an option for removing all
existing track statistics tags from a file. Part of the
implementation of #1507.

View File

@ -2230,7 +2230,7 @@ kax_reader_c::process_block_group(KaxCluster *cluster,
int
kax_reader_c::get_progress() {
if (0 != m_segment_duration)
return (m_last_timecode - std::max(m_first_timecode, static_cast<int64_t>(0))) * 100 / m_segment_duration;
return std::min(m_last_timecode, m_segment_duration) * 100 / m_segment_duration;
return 100 * m_in->getFilePointer() / m_size;
}