ice: emit signal during connection

Change-Id: I4b711b79f6d5cb4b6e2141ea474bc5c4697b9c45
This commit is contained in:
Adrien Béraud
2019-11-13 12:50:16 -05:00
parent 9bc48951af
commit 56d613b0f8
5 changed files with 16 additions and 1 deletions

View File

@ -47,6 +47,7 @@ public:
virtual void recordStateChange(const std::string& call_id, int state){} virtual void recordStateChange(const std::string& call_id, int state){}
virtual void onRtcpReportReceived(const std::string& call_id, const std::map<std::string, int>& stats){} virtual void onRtcpReportReceived(const std::string& call_id, const std::map<std::string, int>& stats){}
virtual void peerHold(const std::string& call_id, bool holding){} virtual void peerHold(const std::string& call_id, bool holding){}
virtual void connectionUpdate(const std::string& id, int state){}
}; };
@ -132,4 +133,5 @@ public:
virtual void recordStateChange(const std::string& call_id, int state){} virtual void recordStateChange(const std::string& call_id, int state){}
virtual void onRtcpReportReceived(const std::string& call_id, const std::map<std::string, int>& stats){} virtual void onRtcpReportReceived(const std::string& call_id, const std::map<std::string, int>& stats){}
virtual void peerHold(const std::string& call_id, bool holding){} virtual void peerHold(const std::string& call_id, bool holding){}
virtual void connectionUpdate(const std::string& id, int state){}
}; };

View File

@ -237,7 +237,8 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
exportable_callback<CallSignal::ConferenceRemoved>(bind(&Callback::conferenceRemoved, callM, _1)), exportable_callback<CallSignal::ConferenceRemoved>(bind(&Callback::conferenceRemoved, callM, _1)),
exportable_callback<CallSignal::RecordingStateChanged>(bind(&Callback::recordingStateChanged, callM, _1, _2)), exportable_callback<CallSignal::RecordingStateChanged>(bind(&Callback::recordingStateChanged, callM, _1, _2)),
exportable_callback<CallSignal::RtcpReportReceived>(bind(&Callback::onRtcpReportReceived, callM, _1, _2)), exportable_callback<CallSignal::RtcpReportReceived>(bind(&Callback::onRtcpReportReceived, callM, _1, _2)),
exportable_callback<CallSignal::PeerHold>(bind(&Callback::peerHold, callM, _1, _2)) exportable_callback<CallSignal::PeerHold>(bind(&Callback::peerHold, callM, _1, _2)),
exportable_callback<CallSignal::ConnectionUpdate>(bind(&Callback::connectionUpdate, callM, _1, _2))
}; };
// Configuration event handlers // Configuration event handlers

View File

@ -47,6 +47,7 @@ getSignalHandlers()
exported_callback<DRing::CallSignal::VideoMuted>(), exported_callback<DRing::CallSignal::VideoMuted>(),
exported_callback<DRing::CallSignal::AudioMuted>(), exported_callback<DRing::CallSignal::AudioMuted>(),
exported_callback<DRing::CallSignal::SmartInfo>(), exported_callback<DRing::CallSignal::SmartInfo>(),
exported_callback<DRing::CallSignal::ConnectionUpdate>(),
/* Configuration */ /* Configuration */
exported_callback<DRing::ConfigurationSignal::VolumeChanged>(), exported_callback<DRing::ConfigurationSignal::VolumeChanged>(),

View File

@ -185,6 +185,10 @@ struct DRING_PUBLIC CallSignal {
constexpr static const char* name = "SmartInfo"; constexpr static const char* name = "SmartInfo";
using cb_type = void(const std::map<std::string, std::string>&); using cb_type = void(const std::map<std::string, std::string>&);
}; };
struct DRING_PUBLIC ConnectionUpdate {
constexpr static const char* name = "ConnectionUpdate";
using cb_type = void(const std::string&, int);
};
}; };
} // namespace DRing } // namespace DRing

View File

@ -25,6 +25,7 @@
#include "manager.h" #include "manager.h"
#include "upnp/upnp_control.h" #include "upnp/upnp_control.h"
#include "transport/peer_channel.h" #include "transport/peer_channel.h"
#include "dring/callmanager_interface.h"
#include <pjlib.h> #include <pjlib.h>
@ -387,6 +388,8 @@ IceTransport::Impl::~Impl()
if (config_.stun_cfg.timer_heap) if (config_.stun_cfg.timer_heap)
pj_timer_heap_destroy(config_.stun_cfg.timer_heap); pj_timer_heap_destroy(config_.stun_cfg.timer_heap);
emitSignal<DRing::CallSignal::ConnectionUpdate>(std::to_string((uintptr_t)this), 2);
} }
bool bool
@ -919,6 +922,8 @@ IceTransport::start(const Attribute& rem_attrs, const std::vector<IceCandidate>&
pimpl_->is_stopped_ = true; pimpl_->is_stopped_ = true;
return false; return false;
} }
emitSignal<DRing::CallSignal::ConnectionUpdate>(std::to_string((uintptr_t)pimpl_.get()), 0);
return true; return true;
} }
@ -952,6 +957,8 @@ IceTransport::start(const SDP& sdp)
pimpl_->is_stopped_ = true; pimpl_->is_stopped_ = true;
return false; return false;
} }
emitSignal<DRing::CallSignal::ConnectionUpdate>(std::to_string((uintptr_t)pimpl_.get()), 0);
return true; return true;
} }