Fix T47135: VSE importing sound is one frame longer than video.

Issue is with rounding up of length reported by audaspace for audio part - when it matches nearly exactly
the actual video length, using ceil() would make it one frame longer. Now apply a small (0.0001 frame)
negative offset to prevent this effect.
This commit is contained in:
Bastien Montagne 2016-01-08 09:39:04 +01:00
parent 1341f91695
commit 15faab0082
Notes: blender-bot 2023-02-14 08:19:24 +01:00
Referenced by issue #47135, VSE importing sound is one frame longer than video
1 changed files with 2 additions and 1 deletions

View File

@ -5131,7 +5131,8 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
/* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = (int)ceil((double)info.length * FPS);
/* We add a very small negative offset here, because ceil(132.0) == 133.0, not nice with videos, see T47135. */
seq->len = (int)ceil((double)info.length * FPS - 1e-4);
strip->us = 1;
/* we only need 1 element to store the filename */