dtvrecorder: Flush the payload buffer whenever a new payload starts.

We start buffering at the beginning of each payload, and don't write out the
data until we know if this payload has a keyframe.  This is so a new file
(for back to back recordings) would start on a keyframe.

Further, the keyframe offset recorded in the DB, is the offset to the
beginning of the payload with the keyframe.  Or at least it was supposed to
be.  Since we were not actually flushing any data currently in the buffer at
the start of a payload, that offset could be pointing to a completely
different payload!

(cherry picked from commit 09b787346e5de8809b3905e64c1887dd273a860e)
(cherry picked from commit 10e87f5d318e68bf2067fc22e24d31443b778717)