Page MenuHome

Fix T74111: Animation Playback Delayed With Time Remapping And AV-Sync
AcceptedPublic

Authored by Sebastian Parborg (zeddb) on Thu, Mar 26, 7:10 PM.

Details

Summary

When setting the current playback time in BKE_sound_play_scene we didn't account for the frame length. So the current frame/time would be wrong when we asked the audio playback what time it was. This would lead to playback being offset when using time remapping and AV sync.

Hopefully this doesn't break stuff horribly... Didn't manage to spot anything obvious with some quick tests I did.

Diff Detail

Event Timeline

Sebastian Parborg (zeddb) edited the summary of this revision. (Show Details)

I think this is our best option if we don't change sound pitch. So I will accept, but still would like to know Sergey's opinion.

I have tested this, and it has still problem with quite extreme time remapping values (if you start with playhead at 0.999, it still has to catch up).
You can fix this edge case by adding SUBFRA to playback start time calculation.
const float cur_time = (float)((double)((CFRA + SUBFRA) / scene->r.framelen) / FPS);

This revision is now accepted and ready to land.Fri, Mar 27, 8:14 PM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/blenkernel/intern/sound.c
553–558

Please keep such changes out of a functional patch, and just commit them.

759

Use FRA2TIME(CFRA/scene->r.framelen) here, instead of dividing by FPS. If the readability isn't convincing enough, maybe the performance gain wins you over (it removes a division).