Skip to content
Snippets Groups Projects
Commit 10e27b3a authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'fix_bitrate_conversion' into 'develop'

Fix string bitrate to unit and value conversion

See merge request !82
parents 370e8368 c8e55670
No related branches found
No related tags found
1 merge request!82Fix string bitrate to unit and value conversion
......@@ -171,7 +171,7 @@ bool sdf_conversions::parse_bitrate_string(
while (bw_value > UINT16_MAX) {
if (bitrate_int == 6) {
logger_common::common().warn(
"Bitrate cannot be higher than %d x 256 PBPS", bw_value);
"Bitrate cannot be higher than %lf x 256 PBPS", bw_value);
}
if (bitrate_int == 5) {
bw_value = bw_value / 256;
......@@ -184,8 +184,11 @@ bool sdf_conversions::parse_bitrate_string(
// Here we have to handle the fractional part, as 3GPP also allows that
// we check if bw_value has fractional parts
while (long(bw_value) != bw_value) {
if (bitrate_int == 1 || (long(bw_value / 1000) > (UINT16_MAX / 1000))) {
if (bitrate_int == 1 || bw_value * 1000 > UINT16_MAX) {
// we possibly cant make it smaller, so we just cut it off
logger_common::common().warn(
"Bitrate value is limited to uint 16. Value is cut of to %ld",
long(bw_value + 0.5));
break;
}
bw_value = bw_value * 1000;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment