зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1015409 - Fix trickle between CreateOffer() and SetLocal(). r=bwc
This commit is contained in:
Родитель
4a08636d20
Коммит
017a4114a2
|
@ -765,7 +765,7 @@ static sm_function_t fsmdef_function_table[FSMDEF_S_MAX][CC_MSG_MAX] =
|
||||||
/* CC_MSG_ADDSTREAM */ fsmdef_ev_addstream,
|
/* CC_MSG_ADDSTREAM */ fsmdef_ev_addstream,
|
||||||
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_removestream,
|
/* CC_MSG_REMOVESTREAM */ fsmdef_ev_removestream,
|
||||||
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
|
/* CC_MSG_ADDCANDIDATE */ fsmdef_ev_addcandidate,
|
||||||
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_default
|
/* CC_MSG_FOUNDCANDIDATE */ fsmdef_ev_foundcandidate
|
||||||
},
|
},
|
||||||
|
|
||||||
/* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */
|
/* FSMDEF_S_HAVE_LOCAL_PRANSWER -------------------------------------------- */
|
||||||
|
@ -4253,14 +4253,16 @@ fsmdef_ev_foundcandidate(sm_event_t *event) {
|
||||||
return (SM_RC_END);
|
return (SM_RC_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Distinguish between the following two cases:
|
/* Distinguish between the following three cases:
|
||||||
|
|
||||||
1. CreateOffer() has been called but SetLocalDesc() has not.
|
1. CreateOffer() has been called but SetLocalDesc() has not.
|
||||||
2. We are mid-call.
|
2. We are mid-call.
|
||||||
|
3. We have a remote offer and CreateAnswer() has been called
|
||||||
|
but SetLocalDesc() has not
|
||||||
|
|
||||||
Both of these are in state STABLE but only in one do we
|
The first two of these are in state STABLE but only in
|
||||||
pass up trickle candidates. In the other we buffer them
|
the second do pass up trickle candidates. In the other
|
||||||
and send them later.
|
two we buffer them and send them later.
|
||||||
*/
|
*/
|
||||||
/* Smuggle the entire candidate structure in a string */
|
/* Smuggle the entire candidate structure in a string */
|
||||||
PR_snprintf(candidate_tmp, sizeof(candidate_tmp), "%d\t%s\t%s",
|
PR_snprintf(candidate_tmp, sizeof(candidate_tmp), "%d\t%s\t%s",
|
||||||
|
@ -4268,8 +4270,8 @@ fsmdef_ev_foundcandidate(sm_event_t *event) {
|
||||||
(char *)msg->data.candidate.mid,
|
(char *)msg->data.candidate.mid,
|
||||||
(char *)msg->data.candidate.candidate);
|
(char *)msg->data.candidate.candidate);
|
||||||
|
|
||||||
if (fcb->state == FSMDEF_S_STABLE) {
|
if ((fcb->state == FSMDEF_S_STABLE && !dcb->sdp->dest_sdp)
|
||||||
if (!dcb->sdp->dest_sdp) {
|
|| fcb->state == FSMDEF_S_HAVE_REMOTE_OFFER) {
|
||||||
fsmdef_candidate_t *buffered_cand = NULL;
|
fsmdef_candidate_t *buffered_cand = NULL;
|
||||||
|
|
||||||
FSM_DEBUG_SM(DEB_F_PREFIX"dcb->sdp->dest_sdp is null."
|
FSM_DEBUG_SM(DEB_F_PREFIX"dcb->sdp->dest_sdp is null."
|
||||||
|
@ -4289,7 +4291,6 @@ fsmdef_ev_foundcandidate(sm_event_t *event) {
|
||||||
/* Don't notify upward */
|
/* Don't notify upward */
|
||||||
return SM_RC_END;
|
return SM_RC_END;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
|
ui_ice_candidate_found(evFoundIceCandidate, fcb->state, line, call_id,
|
||||||
dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
|
dcb->caller_id.call_instance_id, strlib_malloc(local_sdp,-1),
|
||||||
|
|
|
@ -149,7 +149,6 @@ static const std::string strSampleSdpAudioVideoNoIce =
|
||||||
"a=candidate:1 1 UDP 2130706431 192.168.2.3 50007 typ host\r\n"
|
"a=candidate:1 1 UDP 2130706431 192.168.2.3 50007 typ host\r\n"
|
||||||
"a=candidate:2 2 UDP 2130706431 192.168.2.4 50008 typ host\r\n";
|
"a=candidate:2 2 UDP 2130706431 192.168.2.4 50008 typ host\r\n";
|
||||||
|
|
||||||
|
|
||||||
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";
|
||||||
|
|
||||||
|
@ -157,6 +156,27 @@ static const std::string strSampleMid = "";
|
||||||
|
|
||||||
static const unsigned short nSamplelevel = 2;
|
static const unsigned short nSamplelevel = 2;
|
||||||
|
|
||||||
|
static const std::string strG711SdpOffer =
|
||||||
|
"v=0\r\n"
|
||||||
|
"o=- 1 1 IN IP4 148.147.200.251\r\n"
|
||||||
|
"s=-\r\n"
|
||||||
|
"b=AS:64\r\n"
|
||||||
|
"t=0 0\r\n"
|
||||||
|
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
||||||
|
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
||||||
|
"m=audio 9000 RTP/AVP 0 8 126\r\n"
|
||||||
|
"c=IN IP4 148.147.200.251\r\n"
|
||||||
|
"b=TIAS:64000\r\n"
|
||||||
|
"a=rtpmap:0 PCMU/8000\r\n"
|
||||||
|
"a=rtpmap:8 PCMA/8000\r\n"
|
||||||
|
"a=rtpmap:126 telephone-event/8000\r\n"
|
||||||
|
"a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
|
||||||
|
"a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
|
||||||
|
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
||||||
|
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
||||||
|
"a=sendrecv\r\n";
|
||||||
|
|
||||||
|
|
||||||
enum sdpTestFlags
|
enum sdpTestFlags
|
||||||
{
|
{
|
||||||
SHOULD_SEND_AUDIO = (1<<0),
|
SHOULD_SEND_AUDIO = (1<<0),
|
||||||
|
@ -2459,25 +2479,7 @@ TEST_F(SignalingTest, AudioOnlyG711Call)
|
||||||
EnsureInit();
|
EnsureInit();
|
||||||
|
|
||||||
sipcc::MediaConstraints constraints;
|
sipcc::MediaConstraints constraints;
|
||||||
std::string offer =
|
const std::string& offer(strG711SdpOffer);
|
||||||
"v=0\r\n"
|
|
||||||
"o=- 1 1 IN IP4 148.147.200.251\r\n"
|
|
||||||
"s=-\r\n"
|
|
||||||
"b=AS:64\r\n"
|
|
||||||
"t=0 0\r\n"
|
|
||||||
"a=fingerprint:sha-256 F3:FA:20:C0:CD:48:C4:5F:02:5F:A5:D3:21:D0:2D:48:"
|
|
||||||
"7B:31:60:5C:5A:D8:0D:CD:78:78:6C:6D:CE:CC:0C:67\r\n"
|
|
||||||
"m=audio 9000 RTP/AVP 0 8 126\r\n"
|
|
||||||
"c=IN IP4 148.147.200.251\r\n"
|
|
||||||
"b=TIAS:64000\r\n"
|
|
||||||
"a=rtpmap:0 PCMU/8000\r\n"
|
|
||||||
"a=rtpmap:8 PCMA/8000\r\n"
|
|
||||||
"a=rtpmap:126 telephone-event/8000\r\n"
|
|
||||||
"a=candidate:0 1 udp 2130706432 148.147.200.251 9000 typ host\r\n"
|
|
||||||
"a=candidate:0 2 udp 2130706432 148.147.200.251 9005 typ host\r\n"
|
|
||||||
"a=ice-ufrag:cYuakxkEKH+RApYE\r\n"
|
|
||||||
"a=ice-pwd:bwtpzLZD+3jbu8vQHvEa6Xuq\r\n"
|
|
||||||
"a=sendrecv\r\n";
|
|
||||||
|
|
||||||
std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
|
std::cout << "Setting offer to:" << std::endl << indent(offer) << std::endl;
|
||||||
a2_->SetRemote(TestObserver::OFFER, offer);
|
a2_->SetRemote(TestObserver::OFFER, offer);
|
||||||
|
@ -3094,6 +3096,48 @@ TEST_F(SignalingAgentTest, CreateOfferSetLocalTrickleTestServer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(SignalingAgentTest, CreateAnswerSetLocalTrickleTestServer) {
|
||||||
|
TestStunServer::GetInstance()->SetActive(false);
|
||||||
|
TestStunServer::GetInstance()->SetResponseAddr(
|
||||||
|
kBogusSrflxAddress, kBogusSrflxPort);
|
||||||
|
|
||||||
|
CreateAgent(
|
||||||
|
TestStunServer::GetInstance()->addr(),
|
||||||
|
TestStunServer::GetInstance()->port(),
|
||||||
|
false);
|
||||||
|
|
||||||
|
std::string offer(strG711SdpOffer);
|
||||||
|
agent(0)->SetRemote(TestObserver::OFFER, offer, true,
|
||||||
|
PCImplSignalingState::SignalingHaveRemoteOffer);
|
||||||
|
ASSERT_EQ(agent(0)->pObserver->lastStatusCode,
|
||||||
|
sipcc::PeerConnectionImpl::kNoError);
|
||||||
|
|
||||||
|
sipcc::MediaConstraints constraints;
|
||||||
|
agent(0)->CreateAnswer(constraints, offer, ANSWER_AUDIO, DONT_CHECK_AUDIO);
|
||||||
|
|
||||||
|
// Verify that the bogus addr is not there.
|
||||||
|
ASSERT_FALSE(agent(0)->AnswerContains(kBogusSrflxAddress));
|
||||||
|
|
||||||
|
// Now enable the STUN server.
|
||||||
|
TestStunServer::GetInstance()->SetActive(true);
|
||||||
|
agent(0)->WaitForGather();
|
||||||
|
|
||||||
|
// There shouldn't be any candidates until SetLocal.
|
||||||
|
ASSERT_EQ(0U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
|
||||||
|
|
||||||
|
agent(0)->SetLocal(TestObserver::ANSWER, agent(0)->answer());
|
||||||
|
PR_Sleep(1000); // Give time for the message queues.
|
||||||
|
|
||||||
|
// Verify that we got our candidates.
|
||||||
|
ASSERT_LE(2U, agent(0)->MatchingCandidates(kBogusSrflxAddress));
|
||||||
|
|
||||||
|
// Verify that the candidates appear in the answer.
|
||||||
|
size_t match;
|
||||||
|
match = agent(0)->getLocalDescription().find(kBogusSrflxAddress);
|
||||||
|
ASSERT_LT(0U, match);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_F(SignalingAgentTest, CreateUntilFailThenWait) {
|
TEST_F(SignalingAgentTest, CreateUntilFailThenWait) {
|
||||||
int i;
|
int i;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче