Add profiling prints for audio synch to detect how continuous our frame
progression is
This commit is contained in:
parent
74e8e14cce
commit
7b7eac9211
@ -3413,10 +3413,17 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define PROFILE_AUDIO_SYNCH
|
||||||
|
|
||||||
static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
||||||
{
|
{
|
||||||
bScreen *screen = CTX_wm_screen(C);
|
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) {
|
if (screen->animtimer && screen->animtimer == event->customdata) {
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
Scene *scene = CTX_data_scene(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)))
|
finite(time = BKE_sound_sync_scene(scene)))
|
||||||
{
|
{
|
||||||
double newfra = (double)time * FPS;
|
double newfra = (double)time * FPS;
|
||||||
|
|
||||||
/* give some space here to avoid jumps */
|
/* give some space here to avoid jumps */
|
||||||
if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra)
|
if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra)
|
||||||
scene->r.cfra++;
|
scene->r.cfra++;
|
||||||
else
|
else
|
||||||
scene->r.cfra = newfra + 0.5;
|
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 {
|
else {
|
||||||
if (sync) {
|
if (sync) {
|
||||||
|
Loading…
Reference in New Issue
Block a user