Bug 825336: Add constraint to suppress data channel r=jesup

This commit is contained in:
EKR 2012-12-28 12:09:58 -08:00
Родитель 7effa070cf
Коммит d168fe854b
3 изменённых файлов: 34 добавлений и 4 удалений

Просмотреть файл

@ -220,6 +220,12 @@ void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
constraints->constraints[i]->name) == 0) {
gsmsdp_process_cap_constraint(&dcb->media_cap_tbl->cap[CC_VIDEO_1],
constraints->constraints[i]->value);
} else if (strcmp(constraints_table[MozDontOfferDataChannel].name,
constraints->constraints[i]->name) == 0) {
/* Hack to suppress data channel */
if (constraints->constraints[i]->value[0] == 'T') {
dcb->media_cap_tbl->cap[CC_DATACHANNEL_1].enabled = FALSE;
}
}
}
}

Просмотреть файл

@ -40,13 +40,15 @@ typedef struct {
typedef enum constraints_ {
OfferToReceiveAudio = 0,
OfferToReceiveVideo = 1,
VoiceActivityDetection = 2
VoiceActivityDetection = 2,
MozDontOfferDataChannel = 3
} constraints;
static const gsmsdp_key_table_entry_t constraints_table[] = {
{"OfferToReceiveAudio", OfferToReceiveAudio},
{"OfferToReceiveVideo", OfferToReceiveVideo},
{"VoiceActivityDetection", VoiceActivityDetection}
{"VoiceActivityDetection", VoiceActivityDetection},
{"MozDontOfferDataChannel", MozDontOfferDataChannel}
};
cc_causes_t gsmsdp_create_local_sdp(fsmdef_dcb_t *dcb_p, boolean force_streams_enabled,

Просмотреть файл

@ -87,6 +87,9 @@ enum sdpTestFlags
SHOULD_OMIT_VIDEO = (1<<12),
DONT_CHECK_VIDEO = (1<<13),
SHOULD_OMIT_DATA = (1 << 16),
DONT_CHECK_DATA = (1 << 17),
SHOULD_SENDRECV_AUDIO = SHOULD_SEND_AUDIO | SHOULD_RECV_AUDIO,
SHOULD_SENDRECV_VIDEO = SHOULD_SEND_VIDEO | SHOULD_RECV_VIDEO,
SHOULD_SENDRECV_AV = SHOULD_SENDRECV_AUDIO | SHOULD_SENDRECV_VIDEO,
@ -601,7 +604,9 @@ class SignalingAgent {
void CreateAnswer(sipcc::MediaConstraints& constraints, std::string offer,
uint32_t offerAnswerFlags,
uint32_t sdpCheck = DONT_CHECK_AUDIO|DONT_CHECK_VIDEO) {
uint32_t sdpCheck = DONT_CHECK_AUDIO|
DONT_CHECK_VIDEO|
DONT_CHECK_DATA) {
// Create a media stream as if it came from GUM
nsRefPtr<nsDOMMediaStream> domMediaStream = new nsDOMMediaStream();
@ -752,6 +757,8 @@ private:
<< ((flags & SHOULD_OMIT_VIDEO)?" SHOULD_OMIT_VIDEO":"")
<< ((flags & DONT_CHECK_VIDEO)?" DONT_CHECK_VIDEO":"")
<< ((flags & SHOULD_OMIT_DATA)?" SHOULD_OMIT_DATA":"")
<< ((flags & DONT_CHECK_DATA)?" DONT_CHECK_DATA":"")
<< endl;
switch(flags & AUDIO_FLAGS) {
@ -827,6 +834,12 @@ private:
default:
ASSERT_FALSE("Missing case in switch statement");
}
if (flags & SHOULD_OMIT_DATA) {
ASSERT_EQ(sdp.find("m=application"), std::string::npos);
} else if (!(flags & DONT_CHECK_DATA)) {
ASSERT_NE(sdp.find("m=application"), std::string::npos);
}
}
};
@ -987,6 +1000,15 @@ TEST_F(SignalingTest, CreateOfferNoAudioStream)
SHOULD_OMIT_AUDIO | SHOULD_SENDRECV_VIDEO);
}
TEST_F(SignalingTest, CreateOfferNoDataChannel)
{
sipcc::MediaConstraints constraints;
constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
constraints.setBooleanConstraint("OfferToReceiveVideo", true, false);
constraints.setBooleanConstraint("MozDontOfferDataChannel", true, false);
CreateOffer(constraints, OFFER_AV, SHOULD_SENDRECV_AV | SHOULD_OMIT_DATA);
}
TEST_F(SignalingTest, CreateOfferDontReceiveAudio)
{
sipcc::MediaConstraints constraints;
@ -1376,7 +1398,7 @@ TEST_F(SignalingTest, AudioOnlyG711Call)
std::cout << "Creating answer:" << std::endl;
a2_.CreateAnswer(constraints, offer, OFFER_AUDIO | ANSWER_AUDIO,
DONT_CHECK_AUDIO | DONT_CHECK_VIDEO);
DONT_CHECK_AUDIO | DONT_CHECK_VIDEO | DONT_CHECK_DATA);
std::string answer = a2_.answer();