summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-01 22:06:07 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commite62afe405510028d71e16c2db92c94063d23a3ba (patch)
treec3fafdad5b2bf0a5689c021cba4ea56b037a7743 /demux/demux.c
parent976ee96e450487e8eb14e7e895d4c39bec14930c (diff)
downloadmpv-e62afe405510028d71e16c2db92c94063d23a3ba.tar.bz2
mpv-e62afe405510028d71e16c2db92c94063d23a3ba.tar.xz
demux: remove further calls to packet size estimation function
May as well be part of the previous commit.
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c7
1 files changed, 5 insertions, 2 deletions
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;