mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1051052 - Made mid an outparam in JsepSession::AddLocalIceCandidate. r=bwc
--HG-- extra : transplant_source : %A4P%E5%0CuZ%DE%86%D2%C5u%3FhV%DBe%A9%CD%BC%8C
This commit is contained in:
parent
4d7947ace5
commit
5b41dcab91
@ -1253,8 +1253,8 @@ PeerConnectionWrapper.prototype = {
|
||||
|
||||
info(this.label + ": iceCandidate = " + JSON.stringify(anEvent.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 has length zero");
|
||||
ok(anEvent.candidate.sdpMid.length > 0, "SDP mid not empty");
|
||||
|
||||
ok(typeof anEvent.candidate.sdpMLineIndex === 'number', "SDP MLine Index needs to exist");
|
||||
this._local_ice_candidates.push(anEvent.candidate);
|
||||
candidateHandler(this.label, anEvent.candidate);
|
||||
|
@ -135,8 +135,8 @@ public:
|
||||
const std::string& mid,
|
||||
uint16_t level) = 0;
|
||||
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
||||
const std::string& mid,
|
||||
uint16_t level,
|
||||
std::string* mid,
|
||||
bool* skipped) = 0;
|
||||
virtual nsresult EndOfLocalCandidates(
|
||||
const std::string& defaultCandidateAddr,
|
||||
|
@ -2399,8 +2399,8 @@ JsepSessionImpl::AddRemoteIceCandidate(const std::string& candidate,
|
||||
|
||||
nsresult
|
||||
JsepSessionImpl::AddLocalIceCandidate(const std::string& candidate,
|
||||
const std::string& mid,
|
||||
uint16_t level,
|
||||
std::string* mid,
|
||||
bool* skipped)
|
||||
{
|
||||
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;
|
||||
|
||||
return mSdpHelper.AddCandidateToSdp(sdp, candidate, mid, level);
|
||||
return mSdpHelper.AddCandidateToSdp(sdp, candidate, *mid, level);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -121,8 +121,8 @@ public:
|
||||
uint16_t level) override;
|
||||
|
||||
virtual nsresult AddLocalIceCandidate(const std::string& candidate,
|
||||
const std::string& mid,
|
||||
uint16_t level,
|
||||
std::string* mid,
|
||||
bool* skipped) override;
|
||||
|
||||
virtual nsresult EndOfLocalCandidates(const std::string& defaultCandidateAddr,
|
||||
|
@ -2675,15 +2675,11 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
|
||||
uint16_t level) {
|
||||
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;
|
||||
|
||||
bool skipped = false;
|
||||
nsresult res = mJsepSession->AddLocalIceCandidate(candidate,
|
||||
mid,
|
||||
level,
|
||||
&mid,
|
||||
&skipped);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
@ -2695,6 +2691,7 @@ PeerConnectionImpl::CandidateReady(const std::string& candidate,
|
||||
candidate.c_str(),
|
||||
static_cast<unsigned>(level),
|
||||
errorString.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (skipped) {
|
||||
|
@ -227,6 +227,27 @@ SdpHelper::IsBundleSlave(const Sdp& sdp, uint16_t level)
|
||||
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
|
||||
SdpHelper::AddCandidateToSdp(Sdp* sdp,
|
||||
const std::string& candidateUntrimmed,
|
||||
|
@ -49,6 +49,9 @@ class SdpHelper {
|
||||
const Sdp& sdp,
|
||||
std::vector<SdpGroupAttributeList::Group>* groups) const;
|
||||
|
||||
nsresult GetMidFromLevel(const Sdp& sdp,
|
||||
uint16_t level,
|
||||
std::string* mid);
|
||||
nsresult GetIdsFromMsid(const Sdp& sdp,
|
||||
const SdpMediaSection& msection,
|
||||
std::string* streamId,
|
||||
|
@ -609,10 +609,12 @@ protected:
|
||||
std::ostringstream candidate;
|
||||
candidate << "0 " << static_cast<uint16_t>(component)
|
||||
<< " UDP 9999 192.168.0.1 " << port << " typ host";
|
||||
std::string mid;
|
||||
bool skipped;
|
||||
session.AddLocalIceCandidate(kAEqualsCandidate + candidate.str(),
|
||||
"", level, &skipped);
|
||||
level, &mid, &skipped);
|
||||
if (!skipped) {
|
||||
// TODO (bug 1095793): Need to add mid to mCandidatesToTrickle
|
||||
mCandidatesToTrickle.push_back(
|
||||
std::pair<uint16_t, std::string>(
|
||||
level, kAEqualsCandidate + candidate.str()));
|
||||
|
@ -145,7 +145,7 @@ static const std::string strSampleSdpAudioVideoNoIce =
|
||||
static const std::string strSampleCandidate =
|
||||
"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;
|
||||
|
||||
@ -1432,6 +1432,7 @@ class SignalingAgent {
|
||||
|
||||
// Verify that adding ICE candidates does not change the signaling state
|
||||
ASSERT_EQ(signaling_state(), endState);
|
||||
ASSERT_NE("", mid);
|
||||
}
|
||||
|
||||
int GetPacketsReceived(const std::string& streamId) const
|
||||
|
Loading…
Reference in New Issue
Block a user