Bug 856319: hook up createDataChannel-before-createOffer to SDP generation from bug 837035 r=ehugg

This commit is contained in:
Randell Jesup 2013-03-31 21:09:26 -04:00
parent 4ebc519636
commit 514846b52a
5 changed files with 19 additions and 16 deletions

View File

@ -270,7 +270,8 @@ PeerConnectionImpl::PeerConnectionImpl()
, mSTSThread(NULL)
, mMedia(new PeerConnectionMedia(this))
, mNumAudioStreams(0)
, mNumVideoStreams(0) {
, mNumVideoStreams(0)
, mHaveDataStream(false) {
#ifdef MOZILLA_INTERNAL_API
MOZ_ASSERT(NS_IsMainThread());
#endif
@ -627,7 +628,7 @@ PeerConnectionImpl::CreateFakeMediaStream(uint32_t aHint, nsIDOMMediaStream** aR
// Stubbing this call out for now.
// We can remove it when we are confident of datachannels being started
// correctly on SDP negotiation
// correctly on SDP negotiation (bug 852908)
NS_IMETHODIMP
PeerConnectionImpl::ConnectDataConnection(uint16_t aLocalport,
uint16_t aRemoteport,
@ -721,8 +722,11 @@ PeerConnectionImpl::CreateDataChannel(const nsACString& aLabel,
CSFLogDebug(logTag, "%s: making DOMDataChannel", __FUNCTION__);
// TODO -- need something like "mCall->addStream(stream_id, 0, DATA);" so
// the SDP can be generated correctly
if (!mHaveDataStream) {
// XXX stream_id of 0 might confuse things...
mCall->addStream(0, 2, DATA);
mHaveDataStream = true;
}
return NS_NewDOMDataChannel(dataChannel.forget(), mWindow, aRetval);
#else

View File

@ -339,6 +339,8 @@ private:
int mNumAudioStreams;
int mNumVideoStreams;
bool mHaveDataStream;
// Holder for error messages from parsing SDP
std::vector<std::string> mSDPParseErrorMessages;

View File

@ -3526,6 +3526,11 @@ fsmdef_ev_addstream(sm_event_t *event) {
dcb->media_cap_tbl->cap[CC_AUDIO_1].support_direction = SDP_DIRECTION_SENDRECV;
dcb->media_cap_tbl->cap[CC_AUDIO_1].pc_stream = msg->data.track.stream_id;
dcb->media_cap_tbl->cap[CC_AUDIO_1].pc_track = msg->data.track.track_id;
} else if (msg->data.track.media_type == DATA) {
dcb->media_cap_tbl->cap[CC_DATACHANNEL_1].enabled = TRUE;
dcb->media_cap_tbl->cap[CC_DATACHANNEL_1].support_direction = SDP_DIRECTION_SENDRECV;
dcb->media_cap_tbl->cap[CC_DATACHANNEL_1].pc_stream = msg->data.track.stream_id;
dcb->media_cap_tbl->cap[CC_DATACHANNEL_1].pc_track = msg->data.track.track_id;
} else {
return (SM_RC_END);
}
@ -3564,11 +3569,11 @@ fsmdef_ev_removestream(sm_event_t *event) {
* will be re-implemented.
*/
if (msg->data.track.media_type == AUDIO) {
dcb->media_cap_tbl->cap[CC_AUDIO_1].enabled = TRUE;
PR_ASSERT(dcb->media_cap_tbl->cap[CC_AUDIO_1].enabled);
dcb->media_cap_tbl->cap[CC_AUDIO_1].support_direction = SDP_DIRECTION_RECVONLY;
dcb->video_pref = SDP_DIRECTION_SENDRECV;
} else if (msg->data.track.media_type == VIDEO) {
dcb->media_cap_tbl->cap[CC_VIDEO_1].enabled = TRUE;
PR_ASSERT(dcb->media_cap_tbl->cap[CC_VIDEO_1].enabled);
dcb->media_cap_tbl->cap[CC_VIDEO_1].support_direction = SDP_DIRECTION_RECVONLY;
} else {
return (SM_RC_END);

View File

@ -147,16 +147,7 @@ static const cc_media_cap_table_t *gsmsdp_get_media_capability (fsmdef_dcb_t *dc
dcb_p->media_cap_tbl->cap[CC_AUDIO_1].enabled = FALSE;
dcb_p->media_cap_tbl->cap[CC_VIDEO_1].enabled = FALSE;
/*
* This really should be set to FALSE unless we have added
* a data channel using createDataChannel(). Right now,
* though, those operations are not queued (and, in fact,
* the W3C hasn't specified the proper behavior here anyway, so
* we would only be implementing speculatively) -- so we'll
* always offer data channels until the standard is
* a bit more set.
*/
dcb_p->media_cap_tbl->cap[CC_DATACHANNEL_1].enabled = TRUE;
dcb_p->media_cap_tbl->cap[CC_DATACHANNEL_1].enabled = FALSE;
dcb_p->media_cap_tbl->cap[CC_AUDIO_1].support_security = TRUE;
dcb_p->media_cap_tbl->cap[CC_VIDEO_1].support_security = TRUE;

View File

@ -548,6 +548,7 @@ typedef enum {
NO_STREAM = -1,
AUDIO,
VIDEO,
DATA,
TYPE_MAX
} cc_media_type_t;