def _update_recording(self, frame, config):
    '''Adds a frame to the current video output.'''
    # pylint: disable=redefined-variable-type
    should_record = config['is_recording']

    if should_record:
      if not self.is_recording:
        self.is_recording = True
        tf.logging.info(
            'Starting recording using %s',
            self.video_writer.current_output().name())
      self.video_writer.write_frame(frame)
    elif self.is_recording:
      self.is_recording = False
      self.video_writer.finish()
      tf.logging.info('Finished recording')