mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Keep RTMP url / key in Calls::GroupCall.
This commit is contained in:
parent
6d1106bc9f
commit
3cf330134b
4 changed files with 27 additions and 2 deletions
|
@ -93,6 +93,9 @@ struct JoinVideoEndpoint {
|
|||
};
|
||||
|
||||
struct JoinBroadcastStream {
|
||||
bool rtmp = false;
|
||||
QString rtmpUrl;
|
||||
QString rtmpKey;
|
||||
};
|
||||
|
||||
using JoinClientFields = std::variant<
|
||||
|
@ -114,7 +117,11 @@ using JoinClientFields = std::variant<
|
|||
return {};
|
||||
}
|
||||
if (document.object().value("stream").toBool()) {
|
||||
return JoinBroadcastStream{};
|
||||
return JoinBroadcastStream{
|
||||
.rtmp = document.object().value("rtmp").toBool(),
|
||||
.rtmpUrl = document.object().value("rtmp_stream_url").toString(),
|
||||
.rtmpKey = document.object().value("rtmp_stream_key").toString(),
|
||||
};
|
||||
}
|
||||
const auto video = document.object().value("video").toObject();
|
||||
return JoinVideoEndpoint{
|
||||
|
@ -575,6 +582,8 @@ GroupCall::GroupCall(
|
|||
, _joinAs(info.joinAs)
|
||||
, _possibleJoinAs(std::move(info.possibleJoinAs))
|
||||
, _joinHash(info.joinHash)
|
||||
, _rtmpUrl(info.rtmpUrl)
|
||||
, _rtmpKey(info.rtmpKey)
|
||||
, _canManage(Data::CanManageGroupCallValue(_peer))
|
||||
, _id(inputCall.c_inputGroupCall().vid().v)
|
||||
, _scheduleDate(info.scheduleDate)
|
||||
|
@ -1855,12 +1864,18 @@ void GroupCall::handlePossibleCreateOrJoinResponse(
|
|||
data.vparams().match([&](const MTPDdataJSON &data) {
|
||||
const auto json = data.vdata().v;
|
||||
const auto response = ParseJoinResponse(json);
|
||||
const auto stream = std::get_if<JoinBroadcastStream>(&response);
|
||||
const auto endpoint = std::get_if<JoinVideoEndpoint>(&response);
|
||||
if (v::is<JoinBroadcastStream>(response)) {
|
||||
if (stream) {
|
||||
if (!_broadcastDcId) {
|
||||
LOG(("Api Error: Empty stream_dc_id in groupCall."));
|
||||
_broadcastDcId = _peer->session().mtp().mainDcId();
|
||||
}
|
||||
if (stream->rtmp) {
|
||||
_rtmp = true;
|
||||
_rtmpUrl = stream->rtmpUrl;
|
||||
_rtmpKey = stream->rtmpKey;
|
||||
}
|
||||
setInstanceMode(InstanceMode::Stream);
|
||||
} else {
|
||||
setInstanceMode(InstanceMode::Rtc);
|
||||
|
|
|
@ -236,6 +236,9 @@ public:
|
|||
[[nodiscard]] bool emptyRtmp() const;
|
||||
[[nodiscard]] rpl::producer<bool> emptyRtmpValue() const;
|
||||
|
||||
[[nodiscard]] QString rtmpUrl() const;
|
||||
[[nodiscard]] QString rtmpKey() const;
|
||||
|
||||
[[nodiscard]] Data::GroupCall *lookupReal() const;
|
||||
[[nodiscard]] rpl::producer<not_null<Data::GroupCall*>> real() const;
|
||||
|
||||
|
@ -592,6 +595,9 @@ private:
|
|||
int64 _serverTimeMs = 0;
|
||||
crl::time _serverTimeMsGotAt = 0;
|
||||
|
||||
QString _rtmpUrl;
|
||||
QString _rtmpKey;
|
||||
|
||||
rpl::variable<MuteState> _muted = MuteState::Muted;
|
||||
rpl::variable<bool> _canManage = false;
|
||||
rpl::variable<bool> _videoIsWorking = false;
|
||||
|
|
|
@ -51,6 +51,7 @@ struct JoinInfo {
|
|||
not_null<PeerData*> joinAs;
|
||||
std::vector<not_null<PeerData*>> possibleJoinAs;
|
||||
QString joinHash;
|
||||
QString rtmpUrl, rtmpKey;
|
||||
TimeId scheduleDate = 0;
|
||||
bool rtmp = false;
|
||||
};
|
||||
|
|
|
@ -271,7 +271,10 @@ void StartRtmpProcess::processUrl(Data data) {
|
|||
void StartRtmpProcess::finish(JoinInfo info) {
|
||||
const auto done = std::move(_request->done);
|
||||
const auto box = _request->box;
|
||||
const auto current = _request->data.current();
|
||||
_request = nullptr;
|
||||
info.rtmpUrl = current.url;
|
||||
info.rtmpKey = current.key;
|
||||
done(std::move(info));
|
||||
if (const auto strong = box.data()) {
|
||||
strong->closeBox();
|
||||
|
|
Loading…
Add table
Reference in a new issue