diff options
author | wm4 <wm4@nowhere> | 2015-10-23 14:53:19 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-23 14:53:19 +0200 |
commit | 955c6843b6b7a491d1707104e5fad048cd1ab72c (patch) | |
tree | 25a603abddfebabb46869a0cef8d11a10ac580ca /player | |
parent | d1528e51d50002a67b692ec359b61aba9258d3c2 (diff) | |
download | mpv-955c6843b6b7a491d1707104e5fad048cd1ab72c.tar.bz2 mpv-955c6843b6b7a491d1707104e5fad048cd1ab72c.tar.xz |
command: do not return 0 for bitrates if unknown
This makes the bitrate properties unavailable, instead of
returning 0 when:
1. No track is selected, or
2. Not enough packets have been read to have a bitrate estimate yet
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index 1bcf0c47e3..79e522c1d9 100644 --- a/player/command.c +++ b/player/command.c @@ -3093,6 +3093,8 @@ static int mp_property_packet_bitrate(void *ctx, struct m_property *prop, double r[STREAM_TYPE_COUNT]; if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_BITRATE_STATS, &r) < 1) return M_PROPERTY_UNAVAILABLE; + if (r[type] < 0) + return M_PROPERTY_UNAVAILABLE; // r[type] is in bytes/second -> bits double rate = r[type] * 8; |