Merge commit '62c18729f1cf8c5f1b7dc6f0d37edbffd2bb78b5'

This commit is contained in:
Andrea Cavalli 2021-01-07 19:38:10 +01:00
commit 2e5d5a81bc
5 changed files with 13 additions and 4 deletions

View File

@ -2140,7 +2140,8 @@ void GroupCallManager::on_receive_group_call_version(InputGroupCallId input_grou
void GroupCallManager::on_participant_speaking_in_group_call(InputGroupCallId input_group_call_id,
const GroupCallParticipant &participant) {
if (participant.active_date < G()->unix_time() - RECENT_SPEAKER_TIMEOUT) {
auto active_date = td::max(participant.active_date, participant.joined_date - 60);
if (active_date < G()->unix_time() - RECENT_SPEAKER_TIMEOUT) {
return;
}
@ -2149,7 +2150,7 @@ void GroupCallManager::on_participant_speaking_in_group_call(InputGroupCallId in
return;
}
on_user_speaking_in_group_call(group_call->group_call_id, participant.user_id, participant.active_date, true);
on_user_speaking_in_group_call(group_call->group_call_id, participant.user_id, active_date, true);
}
void GroupCallManager::on_user_speaking_in_group_call(GroupCallId group_call_id, UserId user_id, int32 date,

View File

@ -92,7 +92,7 @@ class GroupCallManager : public Actor {
struct GroupCallRecentSpeakers;
struct PendingJoinRequest;
static constexpr int32 RECENT_SPEAKER_TIMEOUT = 5 * 60;
static constexpr int32 RECENT_SPEAKER_TIMEOUT = 60 * 60;
static constexpr int32 CHECK_GROUP_CALL_IS_JOINED_TIMEOUT = 10;
void tear_down() override;

View File

@ -98,7 +98,7 @@ void unique(V &v) {
size_t j = 1;
for (size_t i = 1; i < v.size(); i++) {
if (v[i] != v[i - 1]) {
if (v[i] != v[j - 1]) {
if (i != j) {
v[j] = std::move(v[i]);
}

View File

@ -7,6 +7,7 @@
#include "td/utils/translit.h"
#include "td/utils/algorithm.h"
#include "td/utils/format.h"
#include "td/utils/misc.h"
#include "td/utils/utf8.h"

View File

@ -349,8 +349,14 @@ TEST(Misc, remove) {
}
static void test_unique(td::vector<int> v, td::vector<int> expected) {
auto v_str = td::transform(v, &td::to_string<int>);
auto expected_str = td::transform(expected, &td::to_string<int>);
td::unique(v);
ASSERT_EQ(expected, v);
td::unique(v_str);
ASSERT_EQ(expected_str, v_str);
}
TEST(Misc, unique) {
@ -362,6 +368,7 @@ TEST(Misc, unique) {
test_unique({0, 1}, {0, 1});
test_unique({1, 0}, {0, 1});
test_unique({1, 1}, {1});
test_unique({1, 1, 0, 0}, {0, 1});
test_unique({3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 0}, {0, 1, 2, 3});
test_unique({3, 3, 3, 3, 3}, {3});
test_unique({3, 3, -1, 3, 3}, {-1, 3});