@@ -844,7 +844,11 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind
if (os->bit_rate > 0)
snprintf(bandwidth_str, sizeof(bandwidth_str), " bandwidth=\"%d\"", os->bit_rate);
else if (final) {
- int average_bit_rate = os->pos * 8 * AV_TIME_BASE / c->total_duration;
+ int average_bit_rate = 0;
+ if(c->total_duration > 0)
+ {
+ average_bit_rate = os->pos * 8 * AV_TIME_BASE / c->total_duration;
+ }
snprintf(bandwidth_str, sizeof(bandwidth_str), " bandwidth=\"%d\"", average_bit_rate);
} else if (os->first_segment_bit_rate > 0)
snprintf(bandwidth_str, sizeof(bandwidth_str), " bandwidth=\"%d\"", os->first_segment_bit_rate);