src: Fix select_padding_callback which returns value greater than max_payload

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-11 19:19:00 +09:00
parent dbb131d13d
commit cd3eae3dd2
3 changed files with 3 additions and 3 deletions

View File

@ -936,7 +936,7 @@ ssize_t select_padding_callback
return frame->hd.length;
}
if(frame->hd.length == 0) {
return bd;
return std::min(max_payload, bd);
}
return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd);
}

View File

@ -1136,7 +1136,7 @@ ssize_t select_padding_callback
return frame->hd.length;
}
if(frame->hd.length == 0) {
return bd;
return std::min(max_payload, bd);
}
return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd);
}

View File

@ -100,7 +100,7 @@ ssize_t select_padding_callback
{
auto bd = get_config()->padding;
if(frame->hd.length == 0) {
return bd;
return std::min(max_payload, bd);
}
return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd);
}