From e62afe405510028d71e16c2db92c94063d23a3ba Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Jun 2019 22:06:07 +0200 Subject: demux: remove further calls to packet size estimation function May as well be part of the previous commit. --- demux/demux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index e8f9f0a1ea..5b830284ec 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -638,7 +638,8 @@ static void remove_head_packet(struct demux_queue *queue) queue->keyframe_latest = NULL; queue->is_bof = false; - queue->ds->in->total_bytes -= demux_packet_estimate_total_size(dp); + uint64_t end_pos = dp->next ? dp->next->cum_pos : queue->tail_cum_pos; + queue->ds->in->total_bytes -= end_pos - dp->cum_pos; if (queue->num_index && queue->index[0] == dp) MP_TARRAY_REMOVE_AT(queue->index, queue->num_index, 0); @@ -655,10 +656,12 @@ static void clear_queue(struct demux_queue *queue) struct demux_stream *ds = queue->ds; struct demux_internal *in = ds->in; + if (queue->head) + in->total_bytes -= queue->tail_cum_pos - queue->head->cum_pos; + struct demux_packet *dp = queue->head; while (dp) { struct demux_packet *dn = dp->next; - in->total_bytes -= demux_packet_estimate_total_size(dp); assert(ds->reader_head != dp); talloc_free(dp); dp = dn; -- cgit v1.2.3