+ if (frame_duration != last_duration) {
+ // If the frame rate changed, the input clock is also going to change,
+ // so our historical data doesn't make much sense anymore.
+ // Also, format changes typically introduce blips that are not representative
+ // of the typical frame stream. (We make the assumption that format changes
+ // don't happen all the time in regular use; if they did, we should probably
+ // rather keep the history so that we take jitter they may introduce into account.)
+ clear();
+ last_duration = frame_duration;
+ }