Skip to content

Commit dd12b98

Browse files
committed
chore(toxav): tighten the video bitrate
to the same as the vp8 encoder internally checks.
1 parent 9dcc2f5 commit dd12b98

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: toxav/toxav.c

+4-7
Original file line numberDiff line numberDiff line change
@@ -1304,14 +1304,11 @@ static bool audio_bit_rate_invalid(uint32_t bit_rate)
13041304

13051305
static bool video_bit_rate_invalid(uint32_t bit_rate)
13061306
{
1307-
/* https://www.webmproject.org/docs/webm-sdk/structvpx__codec__enc__cfg.html shows the following:
1308-
* unsigned int rc_target_bitrate
1309-
* the range of uint varies from platform to platform
1310-
* though, uint32_t should be large enough to store bitrates,
1311-
* we may want to prevent from passing overflowed bitrates to libvpx
1312-
* more in detail, it's the case where bit_rate is larger than uint, but smaller than uint32_t
1307+
/* Cap the target rate to 1000 Mbps to avoid some integer overflows in
1308+
* target bandwidth calculations.
1309+
* https://github.com/webmproject/libvpx/blob/027bbee30a0103b99d86327b48d29567fed11688/vp8/vp8_cx_iface.c#L350-L352
13131310
*/
1314-
return bit_rate > UINT32_MAX;
1311+
return bit_rate > 1000000;
13151312
}
13161313

13171314
static bool invoke_call_state_callback(ToxAV *av, uint32_t friend_number, uint32_t state)

0 commit comments

Comments
 (0)