mirror of https://github.com/mpv-player/mpv
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).
This commit is contained in:
parent
a714f8e928
commit
5c1fe2a4f3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue