1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d'

* commit '9df9309d233f59d9706444a1e24ac24139f2640d':
  dashenc: calculate stream bitrate from first segment if not available

Merged-by: Rodger Combs <rodger.combs@gmail.com>
This commit is contained in:
Rodger Combs 2017-09-26 14:02:44 -03:00 committed by James Almer
commit 3b9ef13588

View File

@ -754,6 +754,16 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
break;
}
}
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);
if (bitrate >= 0) {
os->bit_rate = bitrate;
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
" bandwidth=\"%d\"", os->bit_rate);
}
}
add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, start_pos, range_length, index_length);
av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path);
}