On Sun, Jul 05, 2020 at 19:34:54 +0800, Hongcheng Zhong wrote:
> +static int abr_rule(ABRContext *c, float bw_estimate)
> +{
> + int ret = -1;
> +
> + if (c->n_throughputs > 6) {
> + if (bw_estimate < c->variants_bitrate[c->cur_pls].value / 1000 * 1.2
> &&
> + bw_estimate > c->variants_bitrate[c->cur_pls].value / 1000 * 0.8)
You are using floats, but this syntax promotes the calculation to
double before casting back to float.
Use 1.2f and 0.8f for float constants.
> + case SEEK_END: {
> + int64_t newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE );
> + if (newpos < 0) {
> + av_log(h, AV_LOG_ERROR,
> + "ABR: seek_end - can't get file size (pos=%lld)\r\n", (long
> long int)pos);
Instead of casting, please just use the correct format specifier for
int64_t, which is %"PRIi64", I believe.
And no "\r\n" please - just "\n".
(Incorrect indentation as well.)
> + }
> + pos = newpos - pos;
> + }
> + break;
> + case AVSEEK_SIZE: {
> + int64_t newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE );
> + return newpos;
> + }
> + break;
> + default:
> + av_log(h, AV_LOG_ERROR,
> + "ABR: no support for seek where 'whence' is %d\r\n", whence);
Incorrect indentation.
> + return AVERROR(EINVAL);
> + }
> +
> + newpos = ffurl_seek( c->hd, c->position, SEEK_SET );
> + if (newpos < 0) {
> + av_log(h, AV_LOG_ERROR,
> + "ABR: nested protocol no support for seek or seek failed\n");
Incorrect indentation.
> + return newpos;
> + }
> + return c->position;
> +}
I believe the blocks inside the switch/case are also incorrectly
indented.
Cheers,
Moritz
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".