* commit '4723c6226aa1ece4099338cc9b38a9cef4fa4846':
dashenc: fix bitrate estimation with correct scaling
Merged-by: James Almer <jamrial@gmail.com>
... | ... |
@@ -1005,7 +1005,9 @@ static int dash_flush(AVFormatContext *s, int final, int stream) |
1005 | 1005 |
|
1006 | 1006 |
if (!os->bit_rate) { |
1007 | 1007 |
// calculate average bitrate of first segment |
1008 |
- int64_t bitrate = (int64_t) range_length * 8 / ((os->max_pts - os->start_pts) * av_q2d(st->time_base)); |
|
1008 |
+ int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / av_rescale_q(os->max_pts - os->start_pts, |
|
1009 |
+ st->time_base, |
|
1010 |
+ AV_TIME_BASE_Q); |
|
1009 | 1011 |
if (bitrate >= 0) { |
1010 | 1012 |
os->bit_rate = bitrate; |
1011 | 1013 |
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), |