2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support receiving RTMP streams in group calls.

This commit is contained in:
John Preston
2022-02-25 14:14:15 +03:00
parent 9d200017c3
commit 1de35cf8ef
17 changed files with 189 additions and 57 deletions

View File

@@ -718,7 +718,8 @@ void ChannelData::migrateCall(std::unique_ptr<Data::GroupCall> call) {
void ChannelData::setGroupCall(
const MTPInputGroupCall &call,
TimeId scheduleDate) {
TimeId scheduleDate,
bool rtmp) {
call.match([&](const MTPDinputGroupCall &data) {
if (_call && _call->id() == data.vid().v) {
return;
@@ -736,7 +737,8 @@ void ChannelData::setGroupCall(
this,
data.vid().v,
data.vaccess_hash().v,
scheduleDate);
scheduleDate,
rtmp);
owner().registerGroupCall(_call.get());
session().changes().peerUpdated(this, UpdateFlag::GroupCall);
addFlags(Flag::CallActive);

View File

@@ -405,7 +405,8 @@ public:
void migrateCall(std::unique_ptr<Data::GroupCall> call);
void setGroupCall(
const MTPInputGroupCall &call,
TimeId scheduleDate = 0);
TimeId scheduleDate = 0,
bool rtmp = false);
void clearGroupCall();
void setGroupCallDefaultJoinAs(PeerId peerId);
[[nodiscard]] PeerId groupCallDefaultJoinAs() const;

View File

@@ -203,7 +203,8 @@ void ChatData::setMigrateToChannel(ChannelData *channel) {
void ChatData::setGroupCall(
const MTPInputGroupCall &call,
TimeId scheduleDate) {
TimeId scheduleDate,
bool rtmp) {
if (migrateTo()) {
return;
}
@@ -224,7 +225,8 @@ void ChatData::setGroupCall(
this,
data.vid().v,
data.vaccess_hash().v,
scheduleDate);
scheduleDate,
rtmp);
owner().registerGroupCall(_call.get());
session().changes().peerUpdated(this, UpdateFlag::GroupCall);
addFlags(Flag::CallActive);

View File

@@ -148,7 +148,8 @@ public:
}
void setGroupCall(
const MTPInputGroupCall &call,
TimeId scheduleDate = 0);
TimeId scheduleDate = 0,
bool rtmp = false);
void clearGroupCall();
void setGroupCallDefaultJoinAs(PeerId peerId);
[[nodiscard]] PeerId groupCallDefaultJoinAs() const;

View File

@@ -35,6 +35,11 @@ constexpr auto kWaitForUpdatesTimeout = 3 * crl::time(1000);
} // namespace
const std::string &RtmpEndpointId() {
static const auto result = std::string("unified");
return result;
}
const std::string &GroupCallParticipant::cameraEndpoint() const {
return GetCameraEndpoint(videoParams);
}
@@ -55,13 +60,15 @@ GroupCall::GroupCall(
not_null<PeerData*> peer,
CallId id,
CallId accessHash,
TimeId scheduleDate)
TimeId scheduleDate,
bool rtmp)
: _id(id)
, _accessHash(accessHash)
, _peer(peer)
, _reloadByQueuedUpdatesTimer([=] { reload(); })
, _speakingByActiveFinishTimer([=] { checkFinishSpeakingByActive(); })
, _scheduleDate(scheduleDate) {
, _scheduleDate(scheduleDate)
, _rtmp(rtmp) {
}
GroupCall::~GroupCall() {
@@ -78,6 +85,10 @@ bool GroupCall::loaded() const {
return _version > 0;
}
bool GroupCall::rtmp() const {
return _rtmp;
}
not_null<PeerData*> GroupCall::peer() const {
return _peer;
}
@@ -383,6 +394,7 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) {
LOG(("API Error: Got zero version in groupCall."));
_version = 1;
}
_rtmp = data.is_rtmp_stream();
_joinMuted = data.is_join_muted();
_canChangeJoinMuted = data.is_can_change_join_muted();
_joinedToTop = !data.is_join_date_asc();

View File

@@ -19,6 +19,8 @@ struct ParticipantVideoParams;
namespace Data {
[[nodiscard]] const std::string &RtmpEndpointId();
struct LastSpokeTimes {
crl::time anything = 0;
crl::time voice = 0;
@@ -55,11 +57,13 @@ public:
not_null<PeerData*> peer,
CallId id,
CallId accessHash,
TimeId scheduleDate);
TimeId scheduleDate,
bool rtmp);
~GroupCall();
[[nodiscard]] CallId id() const;
[[nodiscard]] bool loaded() const;
[[nodiscard]] bool rtmp() const;
[[nodiscard]] not_null<PeerData*> peer() const;
[[nodiscard]] MTPInputGroupCall input() const;
[[nodiscard]] QString title() const {
@@ -239,6 +243,7 @@ private:
bool _allParticipantsLoaded = false;
bool _joinedToTop = false;
bool _applyingQueuedUpdates = false;
bool _rtmp = false;
};