[FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

Moritz Barsnick barsnick at gmx.net
Sun Sep 18 19:24:17 EEST 2016


On Sun, Sep 18, 2016 at 23:40:34 +0800, Steven Liu wrote:

> +    if (byterange_mode) {
> +        version = 4;
> +        sequence = byterange_mode ? 0 : sequence;

What does the ternary if-then-else operation do here? Two lines above,
byterange_mode was checked for !=0, how can it be anything else here?

> +                av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try use -use_localtime 1 with it\n", c->basename);

"try to use"

> +            if ((outer_st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) &&
> +                outer_st->codecpar->bit_rate > hls->max_seg_size) {

Inconsistent use of brackets: The "==" comparison has extra brackets,
the ">" comparison doesn't. (Or am I missing something with operator
precedence?)

> +                av_log(s, AV_LOG_WARNING, "Your video bitrate is bigger than hls_segment_size, "
> +                       "%"PRId64 " > %" PRId64" ( video birate > hls_segment_size ),the result maybe not you want.",

Apart from the peculiar placement of brackets in the message, I think
the brackets and their content is not needed, duplicate.

And the sentence should end "the result may not be what you want".

> +            if (hls->start_pos >= hls->max_seg_size ) {

Wrong bracket style (whitespace).

> +    {"hls_segment_size", "set maximum size per segment file, (in bytes)",  OFFSET(max_seg_size),    AV_OPT_TYPE_INT,    {.i64 = 0},           0,       INT_MAX,   E},

You can actually drop the word "set ", as well as the comma before the
brackets.

Moritz


More information about the ffmpeg-devel mailing list