diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-27 17:00:01 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-27 17:00:13 +0300 |
commit | 7b7eac921102414f1a9afbb04c79a3386b5cd805 (patch) | |
tree | d8ec0d9d5bac5faa4cb19e858c39f11e27704246 | |
parent | 74e8e14cced7698748c5e4018347438748c499ab (diff) |
Add profiling prints for audio synch to detect how continuous our frame
progression is
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 686f601a839..a192a501177 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3413,10 +3413,17 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 0; } +//#define PROFILE_AUDIO_SYNCH + static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); +#ifdef PROFILE_AUDIO_SYNCH + static int old_frame = 0; + int newfra_int; +#endif + if (screen->animtimer && screen->animtimer == event->customdata) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -3438,11 +3445,24 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv finite(time = BKE_sound_sync_scene(scene))) { double newfra = (double)time * FPS; + /* give some space here to avoid jumps */ if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra) scene->r.cfra++; else scene->r.cfra = newfra + 0.5; + +#ifdef PROFILE_AUDIO_SYNCH + newfra_int = scene->r.cfra; + if (newfra_int < old_frame) { + printf("back jump detected, frame %d!\n", newfra_int); + } + else if (newfra_int > old_frame + 1) { + printf("forward jump detected, frame %d!\n", newfra_int); + } + fflush(stdout); + old_frame = newfra_int; +#endif } else { if (sync) { |