mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Fixed mid on local candidates
This commit is contained in:
@ -157,6 +157,8 @@ private:
|
||||
void processLocalCandidate(Candidate candidate);
|
||||
void processRemoteDescription(Description description);
|
||||
void processRemoteCandidate(Candidate candidate);
|
||||
string localBundleMid() const;
|
||||
|
||||
void triggerDataChannel(std::weak_ptr<DataChannel> weakDataChannel);
|
||||
void triggerTrack(std::shared_ptr<Track> track);
|
||||
bool changeState(State state);
|
||||
|
@ -168,7 +168,9 @@ bool IceTransport::addRemoteCandidate(const Candidate &candidate) {
|
||||
return juice_add_remote_candidate(mAgent.get(), string(candidate).c_str()) >= 0;
|
||||
}
|
||||
|
||||
void IceTransport::gatherLocalCandidates() {
|
||||
void IceTransport::gatherLocalCandidates(string mid) {
|
||||
mMid = std::move(mid);
|
||||
|
||||
// Change state now as candidates calls can be synchronous
|
||||
changeGatheringState(GatheringState::InProgress);
|
||||
|
||||
@ -582,7 +584,9 @@ bool IceTransport::addRemoteCandidate(const Candidate &candidate) {
|
||||
return ret > 0;
|
||||
}
|
||||
|
||||
void IceTransport::gatherLocalCandidates() {
|
||||
void IceTransport::gatherLocalCandidates(string mid) {
|
||||
mMid = std::move(mid);
|
||||
|
||||
// Change state now as candidates calls can be synchronous
|
||||
changeGatheringState(GatheringState::InProgress);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
Description getLocalDescription(Description::Type type) const;
|
||||
void setRemoteDescription(const Description &description);
|
||||
bool addRemoteCandidate(const Candidate &candidate);
|
||||
void gatherLocalCandidates();
|
||||
void gatherLocalCandidates(string mid);
|
||||
|
||||
std::optional<string> getLocalAddress() const;
|
||||
std::optional<string> getRemoteAddress() const;
|
||||
|
@ -189,13 +189,14 @@ void PeerConnection::setLocalDescription(Description::Type type) {
|
||||
|
||||
auto iceTransport = initIceTransport();
|
||||
|
||||
Description localDescription = iceTransport->getLocalDescription(type);
|
||||
processLocalDescription(std::move(localDescription));
|
||||
Description local = iceTransport->getLocalDescription(type);
|
||||
processLocalDescription(std::move(local));
|
||||
|
||||
changeSignalingState(newSignalingState);
|
||||
|
||||
if (mGatheringState == GatheringState::New)
|
||||
iceTransport->gatherLocalCandidates();
|
||||
if (mGatheringState == GatheringState::New) {
|
||||
iceTransport->gatherLocalCandidates(localBundleMid());
|
||||
}
|
||||
}
|
||||
|
||||
void PeerConnection::setRemoteDescription(Description description) {
|
||||
@ -1145,6 +1146,11 @@ void PeerConnection::processRemoteCandidate(Candidate candidate) {
|
||||
}
|
||||
}
|
||||
|
||||
string PeerConnection::localBundleMid() const {
|
||||
std::lock_guard lock(mLocalDescriptionMutex);
|
||||
return mLocalDescription ? mLocalDescription->bundleMid() : "0";
|
||||
}
|
||||
|
||||
void PeerConnection::triggerDataChannel(weak_ptr<DataChannel> weakDataChannel) {
|
||||
auto dataChannel = weakDataChannel.lock();
|
||||
if (!dataChannel)
|
||||
|
Reference in New Issue
Block a user