mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
feat(Conference): use shared_ptr ref sessions
This commit is contained in:
parent
4577b09493
commit
efb0bd5c7a
7 changed files with 55 additions and 50 deletions
|
|
@ -54,8 +54,7 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession () {
|
|||
|
||||
ClientGroupChatRoom::ClientGroupChatRoom (LinphoneCore *core, const Address &me, const string &subject)
|
||||
: ChatRoom(*new ClientGroupChatRoomPrivate(core)), RemoteConference(core, me, nullptr) {
|
||||
string factoryUri = linphone_core_get_conference_factory_uri(core);
|
||||
focus = ObjectFactory::create<Participant>(factoryUri);
|
||||
focus = ObjectFactory::create<Participant>(Address(linphone_core_get_conference_factory_uri(core)));
|
||||
this->subject = subject;
|
||||
}
|
||||
|
||||
|
|
@ -227,12 +226,12 @@ void ClientGroupChatRoom::onSubjectChanged (const std::string &subject) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ClientGroupChatRoom::onCallSessionSetReleased (const std::shared_ptr<const CallSession> session) {
|
||||
void ClientGroupChatRoom::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
|
||||
if (session == focus->getPrivate()->getSession())
|
||||
focus->getPrivate()->removeSession();
|
||||
}
|
||||
|
||||
void ClientGroupChatRoom::onCallSessionStateChanged (const std::shared_ptr<const CallSession> session, LinphoneCallState state, const string &message) {
|
||||
void ClientGroupChatRoom::onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
|
||||
L_D();
|
||||
if (state == LinphoneCallConnected) {
|
||||
if (d->state == ChatRoom::State::CreationPending) {
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ private:
|
|||
|
||||
private:
|
||||
/* CallSessionListener */
|
||||
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> session) override;
|
||||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> session, LinphoneCallState state, const std::string &message) override;
|
||||
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(ClientGroupChatRoom);
|
||||
|
|
|
|||
|
|
@ -93,47 +93,47 @@ void Conference::setSubject (const string &subject) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Conference::onAckBeingSent (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) {
|
||||
void Conference::onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
if (callListener)
|
||||
callListener->onAckBeingSent(headers);
|
||||
}
|
||||
|
||||
void Conference::onAckReceived (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) {
|
||||
void Conference::onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) {
|
||||
if (callListener)
|
||||
callListener->onAckReceived(headers);
|
||||
}
|
||||
|
||||
void Conference::onCallSessionAccepted (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onIncomingCallToBeAdded();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionSetReleased (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCallSetReleased();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionSetTerminated (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCallSetTerminated();
|
||||
}
|
||||
|
||||
void Conference::onCallSessionStateChanged (const std::shared_ptr<const CallSession> session, LinphoneCallState state, const string &message) {
|
||||
void Conference::onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const string &message) {
|
||||
if (callListener)
|
||||
callListener->onCallStateChanged(state, message);
|
||||
}
|
||||
|
||||
void Conference::onCheckForAcceptation (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onCheckForAcceptation();
|
||||
}
|
||||
|
||||
void Conference::onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onIncomingCallStarted();
|
||||
}
|
||||
|
||||
void Conference::onEncryptionChanged (const std::shared_ptr<const CallSession> session, bool activated, const string &authToken) {
|
||||
void Conference::onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const string &authToken) {
|
||||
if (callListener)
|
||||
callListener->onEncryptionChanged(activated, authToken);
|
||||
}
|
||||
|
|
@ -143,22 +143,22 @@ void Conference::onStatsUpdated (const LinphoneCallStats *stats) {
|
|||
callListener->onStatsUpdated(stats);
|
||||
}
|
||||
|
||||
void Conference::onResetCurrentSession (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onResetCurrentSession (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onResetCurrentCall();
|
||||
}
|
||||
|
||||
void Conference::onSetCurrentSession (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onSetCurrentSession (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onSetCurrentCall();
|
||||
}
|
||||
|
||||
void Conference::onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onFirstVideoFrameDecoded();
|
||||
}
|
||||
|
||||
void Conference::onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) {
|
||||
void Conference::onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) {
|
||||
if (callListener)
|
||||
callListener->onResetFirstVideoFrameDecoded();
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ shared_ptr<Participant> Conference::findParticipant (const Address &addr) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
shared_ptr<Participant> Conference::findParticipant (const shared_ptr<const CallSession> session) {
|
||||
shared_ptr<Participant> Conference::findParticipant (const shared_ptr<const CallSession> &session) {
|
||||
for (const auto &participant : participants) {
|
||||
if (participant->getPrivate()->getSession() == session)
|
||||
return participant;
|
||||
|
|
|
|||
|
|
@ -62,26 +62,26 @@ public:
|
|||
|
||||
private:
|
||||
/* CallSessionListener */
|
||||
void onAckBeingSent (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) override;
|
||||
void onAckReceived (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) override;
|
||||
void onCallSessionAccepted (const std::shared_ptr<const CallSession> session) override;
|
||||
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> session) override;
|
||||
void onCallSessionSetTerminated (const std::shared_ptr<const CallSession> session) override;
|
||||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> session, LinphoneCallState state, const std::string &message) override;
|
||||
void onCheckForAcceptation (const std::shared_ptr<const CallSession> session) override;
|
||||
void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> session) override;
|
||||
void onEncryptionChanged (const std::shared_ptr<const CallSession> session, bool activated, const std::string &authToken) override;
|
||||
void onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) override;
|
||||
void onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) override;
|
||||
void onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
|
||||
void onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const std::string &authToken) override;
|
||||
void onStatsUpdated (const LinphoneCallStats *stats) override;
|
||||
void onResetCurrentSession (const std::shared_ptr<const CallSession> session) override;
|
||||
void onSetCurrentSession (const std::shared_ptr<const CallSession> session) override;
|
||||
void onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) override;
|
||||
void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) override;
|
||||
void onResetCurrentSession (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onSetCurrentSession (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) override;
|
||||
|
||||
protected:
|
||||
explicit Conference (LinphoneCore *core, const Address &myAddress, CallListener *listener = nullptr);
|
||||
|
||||
std::shared_ptr<Participant> findParticipant (const Address &addr) const;
|
||||
std::shared_ptr<Participant> findParticipant (const std::shared_ptr<const CallSession> session);
|
||||
std::shared_ptr<Participant> findParticipant (const std::shared_ptr<const CallSession> &session);
|
||||
bool isMe (const Address &addr) const ;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -43,9 +43,14 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
|
|||
|
||||
// =============================================================================
|
||||
|
||||
Participant::Participant (const Address &addr) : Object(*new ParticipantPrivate) {
|
||||
Participant::Participant (const Address &address) : Object(*new ParticipantPrivate) {
|
||||
L_D();
|
||||
d->addr = addr;
|
||||
d->addr = address;
|
||||
}
|
||||
|
||||
Participant::Participant (Address &&address) : Object(*new ParticipantPrivate) {
|
||||
L_D();
|
||||
d->addr = move(address);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ class Participant : public Object {
|
|||
friend class RemoteConference;
|
||||
|
||||
public:
|
||||
Participant (const Address &addr);
|
||||
Participant (const Address &address);
|
||||
Participant (Address &&address);
|
||||
|
||||
const Address& getAddress () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,24 +28,24 @@ class LINPHONE_PUBLIC CallSessionListener {
|
|||
public:
|
||||
virtual ~CallSessionListener() = default;
|
||||
|
||||
virtual void onAckBeingSent (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) = 0;
|
||||
virtual void onAckReceived (const std::shared_ptr<const CallSession> session, LinphoneHeaders *headers) = 0;
|
||||
virtual void onCallSessionAccepted (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onCallSessionSetReleased (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onCallSessionSetTerminated (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onCallSessionStateChanged (const std::shared_ptr<const CallSession> session, LinphoneCallState state, const std::string &message) = 0;
|
||||
virtual void onCheckForAcceptation (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onAckBeingSent (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) = 0;
|
||||
virtual void onAckReceived (const std::shared_ptr<const CallSession> &session, LinphoneHeaders *headers) = 0;
|
||||
virtual void onCallSessionAccepted (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onCallSessionSetReleased (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onCallSessionSetTerminated (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) = 0;
|
||||
virtual void onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
|
||||
virtual void onEncryptionChanged (const std::shared_ptr<const CallSession> session, bool activated, const std::string &authToken) = 0;
|
||||
virtual void onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const std::string &authToken) = 0;
|
||||
|
||||
virtual void onStatsUpdated (const LinphoneCallStats *stats) = 0;
|
||||
|
||||
virtual void onResetCurrentSession (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onSetCurrentSession (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onResetCurrentSession (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onSetCurrentSession (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
|
||||
virtual void onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> session) = 0;
|
||||
virtual void onFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onResetFirstVideoFrameDecoded (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue