summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Schubert <ischluff@mailbox.org>2017-10-26 18:02:04 +0200
committerLuca Barbato <lu_zero@gentoo.org>2017-10-27 19:52:48 +0200
commit4723c6226aa1ece4099338cc9b38a9cef4fa4846 (patch)
treec3cffe39cf4d1affbb2d4abff0c955697d186d4f /libavformat
parent0e702124ee149593168cbbb7b30376249a64ae66 (diff)
dashenc: fix bitrate estimation with correct scaling
Signed-off-by: Anton Schubert <ischluff@mailbox.org> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dashenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 336cea24ec..4f8d7d85dc 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1040,6 +1040,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[i];
+ AVStream *st = s->streams[i];
char filename[1024] = "", full_path[1024], temp_path[1024];
int range_length, index_length = 0;
@@ -1091,7 +1092,9 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
if (!os->bit_rate) {
// calculate average bitrate of first segment
- int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / (os->max_pts - os->start_pts);
+ int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / av_rescale_q(os->max_pts - os->start_pts,
+ st->time_base,
+ AV_TIME_BASE_Q);
if (bitrate >= 0) {
os->bit_rate = bitrate;
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),