summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-05 12:48:58 +0100
committerwm4 <wm4@nowhere>2016-03-05 13:08:38 +0100
commit5c1fe2a4f3e559a0c6a010e48b0c225d01c1cd0a (patch)
treefeb30bb24d85f04bcf30dbc3baa94cfee4686655 /demux/demux.c
parenta714f8e928ba01c595d4ac6812e2e611d3899f09 (diff)
downloadmpv-5c1fe2a4f3e559a0c6a010e48b0c225d01c1cd0a.tar.bz2
mpv-5c1fe2a4f3e559a0c6a010e48b0c225d01c1cd0a.tar.xz
demux: delay bitrate calculation on packets with unknown timestamps
Commit 503c6f7f essentially removed timestamps from "laces" (Block sub- divisions), which means many audio packets will have no timestamp. There's no reason why bitrate calculation can't just delayed to a point when the next timestamp is known. Fixes #2903 (no audio bitrate with mkv files).
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/demux/demux.c b/demux/demux.c
index bd3211a74a..a7241d9a9f 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -681,11 +681,11 @@ static struct demux_packet *dequeue_packet(struct demux_stream *ds)
if (ts != MP_NOPTS_VALUE)
ds->base_ts = ts;
- if (pkt->keyframe) {
+ if (pkt->keyframe && ts != MP_NOPTS_VALUE) {
// Update bitrate - only at keyframe points, because we use the
// (possibly) reordered packet timestamps instead of realtime.
double d = ts - ds->last_br_ts;
- if (ts == MP_NOPTS_VALUE || ds->last_br_ts == MP_NOPTS_VALUE || d < 0) {
+ if (ds->last_br_ts == MP_NOPTS_VALUE || d < 0) {
ds->bitrate = -1;
ds->last_br_ts = ts;
ds->last_br_bytes = 0;