From 0ff59ed27e9f71f8a43ffab0a47cc62f89383acd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 21 Mar 2005 21:21:29 +0000 Subject: [PATCH] Wrong calculation of the duration in case of Vorbis packets whose container timecodes are not what the packet's durations indicate they should be. --- src/output/p_vorbis.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output/p_vorbis.cpp b/src/output/p_vorbis.cpp index f97b6ff2f..263406dd5 100644 --- a/src/output/p_vorbis.cpp +++ b/src/output/p_vorbis.cpp @@ -194,7 +194,9 @@ vorbis_packetizer_c::process(memory_c &mem, if (timecode > (expected_timecode + 100000000)) { chosen_timecode = timecode; - duration = timecode - last_timecode; + duration = timecode - + (last_timecode + last_samples_sum * 1000000000 / vi.rate + + timecode_offset); last_timecode = timecode; last_samples_sum = 0; } else { @@ -218,7 +220,7 @@ vorbis_packetizer_c::process(memory_c &mem, "(last_samples_sum: %lld)\n", chosen_timecode, timecode, expected_timecode, samples_here, last_samples_sum); - add_packet(mem, expected_timecode, duration); + add_packet(mem, chosen_timecode, duration); debug_leave("vorbis_packetizer_c::process");