Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix channel bitrate calculation #568

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/dpp/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class DPP_EXPORT channel : public managed, public json_interface<channel> {
/** Sorting position, lower number means higher up the list */
uint16_t position;

/** the bitrate (in bits) of the voice channel */
/** the bitrate (in kilobits) of the voice channel */
uint16_t bitrate;

/** amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission manage_messages or manage_channel, are unaffected*/
Expand Down Expand Up @@ -438,7 +438,7 @@ class DPP_EXPORT channel : public managed, public json_interface<channel> {
/**
* @brief Set bitrate of this channel object
*
* @param bitrate Bitrate to set
* @param bitrate Bitrate to set (in kilobits)
* @return Reference to self, so these method calls may be chained
*/
channel& set_bitrate(const uint16_t bitrate);
Expand Down
4 changes: 2 additions & 2 deletions src/dpp/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ channel& channel::fill_from_json(json* j) {
set_int16_not_null(j, "default_thread_rate_limit_per_user", this->default_thread_rate_limit_per_user);
set_snowflake_not_null(j, "owner_id", this->owner_id);
set_snowflake_not_null(j, "parent_id", this->parent_id);
this->bitrate = int16_not_null(j, "bitrate")/1024;
this->bitrate = int16_not_null(j, "bitrate")/1000;
this->flags |= bool_not_null(j, "nsfw") ? dpp::c_nsfw : 0;

uint16_t arc = int16_not_null(j, "default_auto_archive_duration");
Expand Down Expand Up @@ -468,7 +468,7 @@ std::string channel::build_json(bool with_id) const {
}
if (is_voice_channel()) {
j["user_limit"] = user_limit;
j["bitrate"] = bitrate*1024;
j["bitrate"] = bitrate*1000;
}
if (is_forum()) {
j["flags"] = (flags & dpp::c_require_tag) ? dpp::dc_require_tag : 0;
Expand Down