def _addEventMediaBufferingEnd(self, event):
        if event.get('x_after_seek') == 'False':
            # only count buffering when not seeking
            return
        self.buffering_events += 1
        if event.get('x_auto'):
            if event['x_auto'] == 'true':
                self.auto_bitrate = True
        # calculate buffering data
        if not self._valid_buffering_length:
            return
        if not self.is_buffering:
            # two MediaBufferingEnd events in a row
            # toss stream
            self._invalidate_buffer_results()
            return
        self.is_buffering = False
        if event.get('x_video_location') != self._video_location_check:
            # we scrubbed during buffering, disregard buffering data
            self._invalidate_buffer_results()
            return
        # subtract MediaBufferingEnd timestamp from 
        # MediaBufferingStart timestamp
        if not self.buffering_length:
            self.buffering_length = 0
        try:
            media_buffering_end_time = datetime.strptime(
                event['event_date'], '%Y-%m-%d %H:%M:%S')
        except (__HOLE__, TypeError):
            # can't parse event_date, can't calculate buffer length
            self._invalidate_buffer_results()
            return
        if media_buffering_end_time < self._buffering_start_time:
            # the MediaBufferingEnd event has a timestamp before its
            # MediaBufferingStart event: bad data
            self._invalidate_buffer_results()
            return
        buffer_delta = media_buffering_end_time - self._buffering_start_time
        self.buffering_length += self._total_seconds(buffer_delta)
        if event.get('x_video_location'):
            loc = event['x_video_location']
            self.buffering_positions.append(loc)
dataset/ETHPy150Open pbs/agora-proc/agora/stats.py/PBSVideoStats._addEventMediaBufferingEnd