mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1051052 - Made mid an outparam in JsepSession::AddLocalIceCandidate. r=bwc
This commit is contained in:
parent
e5a6261ceb
commit
e61426de30
@ -1253,8 +1253,8 @@ PeerConnectionWrapper.prototype = {
|
|||||||
|
|
||||||
info(this.label + ": iceCandidate = " + JSON.stringify(anEvent.candidate));
|
info(this.label + ": iceCandidate = " + JSON.stringify(anEvent.candidate));
|
||||||
ok(anEvent.candidate.candidate.length > 0, "ICE candidate contains candidate");
|
ok(anEvent.candidate.candidate.length > 0, "ICE candidate contains candidate");
|
||||||
// we don't support SDP MID's yet
|
ok(anEvent.candidate.sdpMid.length > 0, "SDP mid not empty");
|
||||||
ok(anEvent.candidate.sdpMid.length === 0, "SDP MID has length zero");
|
|
||||||
ok(typeof anEvent.candidate.sdpMLineIndex === 'number', "SDP MLine Index needs to exist");
|
ok(typeof anEvent.candidate.sdpMLineIndex === 'number', "SDP MLine Index needs to exist");
|
||||||
this._local_ice_candidates.push(anEvent.candidate);
|
this._local_ice_candidates.push(anEvent.candidate);
|
||||||
candidateHandler(this.label, anEvent.candidate);
|
candidateHandler(this.label, anEvent.candidate);
|
||||||
|
@ -135,8 +135,8 @@ public:
|
|||||||
const std::string& mid,
|
const std::string& mid,
|
||||||
uint16_t level) = 0;
|
uint16_t level) = 0;
|
||||||
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
||||||
const std::string& mid,
|
|
||||||
uint16_t level,
|
uint16_t level,
|
||||||
|
std::string* mid,
|
||||||
bool* skipped) = 0;
|
bool* skipped) = 0;
|
||||||
virtual nsresult EndOfLocalCandidates(
|
virtual nsresult EndOfLocalCandidates(
|
||||||
const std::string& defaultCandidateAddr,
|
const std::string& defaultCandidateAddr,
|
||||||
|
@ -2399,8 +2399,8 @@ JsepSessionImpl::AddRemoteIceCandidate(const std::string& candidate,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
|
JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
|
||||||
const std::string& mid,
|
|
||||||
uint16_t level,
|
uint16_t level,
|
||||||
|
std::string* mid,
|
||||||
bool* skipped)
|
bool* skipped)
|
||||||
{
|
{
|
||||||
mLastError.clear();
|
mLastError.clear();
|
||||||
@ -2432,9 +2432,14 @@ JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult rv = mSdpHelper.GetMidFromLevel(*sdp, level, mid);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
*skipped = false;
|
*skipped = false;
|
||||||
|
|
||||||
return mSdpHelper.AddCandidateToSdp(sdp, candidate, mid, level);
|
return mSdpHelper.AddCandidateToSdp(sdp, candidate, *mid, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -121,8 +121,8 @@ public:
|
|||||||
uint16_t level) override;
|
uint16_t level) override;
|
||||||
|
|
||||||
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
||||||
const std::string& mid,
|
|
||||||
uint16_t level,
|
uint16_t level,
|
||||||
|
std::string* mid,
|
||||||
bool* skipped) override;
|
bool* skipped) override;
|
||||||
|
|
||||||
virtual nsresult EndOfLocalCandidates(const std::string& defaultCandidateAddr,
|
virtual nsresult EndOfLocalCandidates(const std::string& defaultCandidateAddr,
|
||||||
|
@ -2675,15 +2675,11 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
|
|||||||
uint16_t level) {
|
uint16_t level) {
|
||||||
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
|
PC_AUTO_ENTER_API_CALL_VOID_RETURN(false);
|
||||||
|
|
||||||
// TODO: What about mid? Is this something that we will choose, or will
|
|
||||||
// JsepSession choose for us? If the latter, we'll need to make it an
|
|
||||||
// outparam or something. Bug 1051052.
|
|
||||||
std::string mid;
|
std::string mid;
|
||||||
|
|
||||||
bool skipped = false;
|
bool skipped = false;
|
||||||
nsresult res = mJsepSession->AddLocalIceCandidate(candidate,
|
nsresult res = mJsepSession->AddLocalIceCandidate(candidate,
|
||||||
mid,
|
|
||||||
level,
|
level,
|
||||||
|
&mid,
|
||||||
&skipped);
|
&skipped);
|
||||||
|
|
||||||
if (NS_FAILED(res)) {
|
if (NS_FAILED(res)) {
|
||||||
@ -2695,6 +2691,7 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
|
|||||||
candidate.c_str(),
|
candidate.c_str(),
|
||||||
static_cast<unsigned>(level),
|
static_cast<unsigned>(level),
|
||||||
errorString.c_str());
|
errorString.c_str());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipped) {
|
if (skipped) {
|
||||||
|
@ -227,6 +227,27 @@ SdpHelper::IsBundleSlave(const Sdp& sdp, uint16_t level)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
SdpHelper::GetMidFromLevel(const Sdp& sdp,
|
||||||
|
uint16_t level,
|
||||||
|
std::string* mid)
|
||||||
|
{
|
||||||
|
if (level >= sdp.GetMediaSectionCount()) {
|
||||||
|
SDP_SET_ERROR("Index " << level << " out of range");
|
||||||
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SdpMediaSection& msection = sdp.GetMediaSection(level);
|
||||||
|
const SdpAttributeList& attrList = msection.GetAttributeList();
|
||||||
|
|
||||||
|
// grab the mid and set the outparam
|
||||||
|
if (attrList.HasAttribute(SdpAttribute::kMidAttribute)) {
|
||||||
|
*mid = attrList.GetMid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
SdpHelper::AddCandidateToSdp(Sdp* sdp,
|
SdpHelper::AddCandidateToSdp(Sdp* sdp,
|
||||||
const std::string& candidateUntrimmed,
|
const std::string& candidateUntrimmed,
|
||||||
|
@ -49,6 +49,9 @@ class SdpHelper {
|
|||||||
const Sdp& sdp,
|
const Sdp& sdp,
|
||||||
std::vector<SdpGroupAttributeList::Group>* groups) const;
|
std::vector<SdpGroupAttributeList::Group>* groups) const;
|
||||||
|
|
||||||
|
nsresult GetMidFromLevel(const Sdp& sdp,
|
||||||
|
uint16_t level,
|
||||||
|
std::string* mid);
|
||||||
nsresult GetIdsFromMsid(const Sdp& sdp,
|
nsresult GetIdsFromMsid(const Sdp& sdp,
|
||||||
const SdpMediaSection& msection,
|
const SdpMediaSection& msection,
|
||||||
std::string* streamId,
|
std::string* streamId,
|
||||||
|
@ -609,10 +609,12 @@ protected:
|
|||||||
std::ostringstream candidate;
|
std::ostringstream candidate;
|
||||||
candidate << "0 " << static_cast<uint16_t>(component)
|
candidate << "0 " << static_cast<uint16_t>(component)
|
||||||
<< " UDP 9999 192.168.0.1 " << port << " typ host";
|
<< " UDP 9999 192.168.0.1 " << port << " typ host";
|
||||||
|
std::string mid;
|
||||||
bool skipped;
|
bool skipped;
|
||||||
session.AddLocalIceCandidate(kAEqualsCandidate + candidate.str(),
|
session.AddLocalIceCandidate(kAEqualsCandidate + candidate.str(),
|
||||||
"", level, &skipped);
|
level, &mid, &skipped);
|
||||||
if (!skipped) {
|
if (!skipped) {
|
||||||
|
// TODO (bug 1095793): Need to add mid to mCandidatesToTrickle
|
||||||
mCandidatesToTrickle.push_back(
|
mCandidatesToTrickle.push_back(
|
||||||
std::pair<uint16_t, std::string>(
|
std::pair<uint16_t, std::string>(
|
||||||
level, kAEqualsCandidate + candidate.str()));
|
level, kAEqualsCandidate + candidate.str()));
|
||||||
|
@ -145,7 +145,7 @@ static const std::string strSampleSdpAudioVideoNoIce =
|
|||||||
static const std::string strSampleCandidate =
|
static const std::string strSampleCandidate =
|
||||||
"a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n";
|
"a=candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host\r\n";
|
||||||
|
|
||||||
static const std::string strSampleMid = "";
|
static const std::string strSampleMid = "sdparta";
|
||||||
|
|
||||||
static const unsigned short nSamplelevel = 2;
|
static const unsigned short nSamplelevel = 2;
|
||||||
|
|
||||||
@ -1432,6 +1432,7 @@ class SignalingAgent {
|
|||||||
|
|
||||||
// Verify that adding ICE candidates does not change the signaling state
|
// Verify that adding ICE candidates does not change the signaling state
|
||||||
ASSERT_EQ(signaling_state(), endState);
|
ASSERT_EQ(signaling_state(), endState);
|
||||||
|
ASSERT_NE("", mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPacketsReceived(const std::string& streamId) const
|
int GetPacketsReceived(const std::string& streamId) const
|
||||||
|
Loading…
Reference in New Issue
Block a user