Merge "Fix bugs regarding clamping of numFrames variable." am: f4935e88d1
am: 716f64f54c

Change-Id: Id52b35a1b5d4fb4f803172f57cabf6487242be85