Bug 729541: Remove 'offer' parameter from RTCPeerConnection.createAnswer r=jesup
authorEnda Mannion <emannion@gmail.com>
Mon, 15 Oct 2012 16:50:10 +0100
changeset 111312 4b997a0e6b5fbe7fb76fc642b7776c6752139f15
parent 111311 fb3f0836b8346bf55b652b0d60cddde387435285
child 111313 a1925dde08ba5656733b72b5d406ab8a8b1a4479
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjesup
bugs729541
milestone19.0a1
Bug 729541: Remove 'offer' parameter from RTCPeerConnection.createAnswer r=jesup
media/webrtc/signaling/include/CC_Call.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
media/webrtc/signaling/src/sipcc/include/ccapi_call.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/media/webrtc/signaling/include/CC_Call.h
+++ b/media/webrtc/signaling/include/CC_Call.h
@@ -265,17 +265,17 @@ namespace CSF
            @param [in] ip address - the ip address of the peer to call
 
            @return void
           */
         virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0;
 
         virtual void createOffer (const cc_media_constraints_t* constraints) = 0;
 
-        virtual void createAnswer(const cc_media_constraints_t* constraints, const std::string & offersdp) = 0;
+        virtual void createAnswer(const cc_media_constraints_t* constraints) = 0;
 
         virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
 
         virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
 
         virtual void setPeerConnection(const std::string& handle) = 0;
 
         virtual void addStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -747,36 +747,38 @@ PeerConnectionImpl::CreateOffer(MediaCon
 
   mCall->createOffer(cc_constraints);
   return NS_OK;
 }
 
 /*
  * the Constraints UI IDL work is being done. The CreateAnswer below is the one
  * currently called by the signaling unit tests.
+ *
+ * The aOffer parameter needs to be removed here and in the PeerConnection IDL
  */
+
 NS_IMETHODIMP
 PeerConnectionImpl::CreateAnswer(const char* constraints, const char* aOffer) {
   MOZ_ASSERT(constraints);
-  MOZ_ASSERT(aOffer);
 
   CheckIceState();
   mRole = kRoleAnswerer;  // TODO(ekr@rtfm.com): Interrogate SIPCC here?
   MediaConstraints aconstraints;
-  CreateAnswer(aconstraints, aOffer);
+  CreateAnswer(aconstraints);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-PeerConnectionImpl::CreateAnswer(MediaConstraints& constraints, const char* offer) {
+PeerConnectionImpl::CreateAnswer(MediaConstraints& constraints) {
 
   cc_media_constraints_t* cc_constraints = nullptr;
   constraints.buildArray(&cc_constraints);
 
-  mCall->createAnswer(cc_constraints, offer);
+  mCall->createAnswer(cc_constraints);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PeerConnectionImpl::SetLocalDescription(int32_t aAction, const char* aSDP) {
   if (!aSDP) {
     CSFLogError(logTag, "%s - aSDP is NULL", __FUNCTION__);
     return NS_ERROR_FAILURE;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -393,17 +393,17 @@ public:
 
   // Create a fake media stream
   nsresult CreateFakeMediaStream(uint32_t hint, nsIDOMMediaStream** retval);
 
   nsPIDOMWindow* GetWindow() const { return mWindow; }
 
   NS_IMETHODIMP CreateOffer(MediaConstraints& constraints);
 
-  NS_IMETHODIMP CreateAnswer(MediaConstraints& constraints, const char* offer);
+  NS_IMETHODIMP CreateAnswer(MediaConstraints& constraints);
 
 private:
   PeerConnectionImpl(const PeerConnectionImpl&rhs);
   PeerConnectionImpl& operator=(PeerConnectionImpl);
 
   void ChangeReadyState(ReadyState aReadyState);
   void CheckIceState() {
     PR_ASSERT(mIceState != kIceGathering);
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
@@ -142,17 +142,16 @@ cc_return_t cc_invokeFeatureSDPMode(cc_c
     case CC_FEATURE_DIALSTR:
     case CC_FEATURE_SPEEDDIAL:
     case CC_FEATURE_BLIND_XFER_WITH_DIALSTRING:
     case CC_FEATURE_END_CALL:
     case CC_FEATURE_B2BCONF:
     case CC_FEATURE_CONF:
     case CC_FEATURE_XFER:
     case CC_FEATURE_HOLD:
-    case CC_FEATURE_CREATEANSWER:
     case CC_FEATURE_SETLOCALDESC:
     case CC_FEATURE_SETREMOTEDESC:
     case CC_FEATURE_SETPEERCONNECTION:
     	callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
         callFeature.featData.ccData.info1 = NULL;
     	break;
     case CC_FEATURE_ADDICECANDIDATE:
     	callFeature.featData.ccData.info = strlib_malloc(data, strlen(data));
@@ -299,22 +298,22 @@ cc_return_t CC_CallFeature_dial(cc_call_
 cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEOFFER, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, 0, constraints, NULL, NULL);
 }
 
-cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints, string_t sdp) {
+cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEANSWER, JSEP_NO_ACTION,
-                                   0, 0, NO_STREAM, 0, constraints, sdp, NULL);
+                                   0, 0, NO_STREAM, 0, constraints, NULL, NULL);
 }
 
 cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
     const cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETLOCALDESC, action,
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
@@ -89,18 +89,18 @@ cc_lineid_t CCAPI_Call_getLine(cc_call_h
 cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits){
 	return CC_CallFeature_dial(handle, video_pref, digits);
 }
 
 cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
 	return CC_CallFeature_CreateOffer(handle, constraints);
 }
 
-cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints, cc_string_t offersdp) {
-	return CC_CallFeature_CreateAnswer(handle, constraints, offersdp);
+cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
+	return CC_CallFeature_CreateAnswer(handle, constraints);
 }
 
 cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
 	return CC_CallFeature_SetLocalDescription(handle, action, sdp);
 }
 
 cc_return_t CCAPI_SetRemoteDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
     return CC_CallFeature_SetRemoteDescription(handle, action, sdp);
--- a/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
+++ b/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
@@ -148,17 +148,17 @@ cc_return_t CC_CallFeature_backSpace(cc_
  * @param video_pref the sdp direction
  * @param numbers dialed string
  * @return SUCCESS or FAILURE
  */
 cc_return_t CC_CallFeature_dial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const cc_string_t numbers);
 
 cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
 
-cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints, const char* sdp);
+cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
 
 cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, const char* sdp);
 
 cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, const char* sdp);
 
 cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc);
 
 cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id, cc_media_track_id_t id, cc_media_type_t media_type);
--- a/media/webrtc/signaling/src/sipcc/include/ccapi_call.h
+++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call.h
@@ -45,17 +45,17 @@ cc_lineid_t CCAPI_Call_getLine(cc_call_h
  * @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook
  * @return SUCCESS or FAILURE
  */
 cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits);
 
 
 cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
 
-cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints, cc_string_t offersdp);
+cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
 
 cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp);
 
 cc_return_t CCAPI_SetRemoteDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp);
 
 cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc);
 
 cc_return_t CCAPI_AddStream(cc_call_handle_t handle, cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
@@ -529,18 +529,19 @@ void CC_SIPCCCall::originateP2PCall (cc_
  * This method works asynchronously, is an onCallEvent with the resulting SDP
  */
 void CC_SIPCCCall::createOffer (const cc_media_constraints_t *constraints) {
     CCAPI_CreateOffer(callHandle, constraints);
 }
 /*
  * This method works asynchronously, there is onCallEvent with the resulting SDP
  */
-void CC_SIPCCCall::createAnswer (const cc_media_constraints_t *constraints, const std::string & offersdp) {
-    CCAPI_CreateAnswer(callHandle, constraints, offersdp.c_str());
+void CC_SIPCCCall::createAnswer (const cc_media_constraints_t *constraints) {
+    CCAPI_CreateAnswer(callHandle, constraints);
+
 }
 
 void CC_SIPCCCall::setLocalDescription(cc_jsep_action_t action, const std::string & sdp) {
     CCAPI_SetLocalDescription(callHandle, action, sdp.c_str());
 }
 
 void CC_SIPCCCall::setRemoteDescription(cc_jsep_action_t action, const std::string & sdp) {
     CCAPI_SetRemoteDescription(callHandle, action, sdp.c_str());
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
@@ -106,17 +106,17 @@ namespace CSF
         virtual bool unmuteAudio();
         virtual bool muteVideo();
         virtual bool unmuteVideo();
         virtual void addStream(int streamId, bool isVideo);
         virtual void removeStream(int streamId);
         virtual bool setVolume(int volume);
         virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip);
         virtual void createOffer(const  cc_media_constraints_t *constraints);
-        virtual void createAnswer(const  cc_media_constraints_t *constraints, const std::string & offersdp);
+        virtual void createAnswer(const  cc_media_constraints_t *constraints);
         virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp);
         virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp);
         virtual void setPeerConnection(const std::string& handle);
         virtual const std::string& getPeerConnection() const;
         virtual void addStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
         virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
         virtual CC_SIPCCCallMediaDataPtr getMediaData();
         virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level);
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -519,17 +519,17 @@ class SignalingAgent {
     offer_ = pObserver->lastString;
   }
 
   void CreateOfferExpectError(sipcc::MediaConstraints& constraints) {
     ASSERT_EQ(pc->CreateOffer(constraints), NS_OK);
     ASSERT_TRUE_WAIT(pObserver->state == TestObserver::stateError, kDefaultTimeout);
   }
 
-  void CreateAnswer(sipcc::MediaConstraints& constraints, std::string offer, bool audio, bool video) {
+  void CreateAnswer(sipcc::MediaConstraints& constraints, bool audio, bool video) {
     // Create a media stream as if it came from GUM
     nsRefPtr<nsDOMMediaStream> domMediaStream = new nsDOMMediaStream();
 
     uint32_t aHintContents = 0;
 
     if (audio) {
       aHintContents |= nsDOMMediaStream::HINT_CONTENTS_AUDIO;
     }
@@ -539,17 +539,17 @@ class SignalingAgent {
 
     PR_ASSERT(aHintContents);
 
     domMediaStream->SetHintContents(aHintContents);
 
     pc->AddStream(domMediaStream);
 
     pObserver->state = TestObserver::stateNoResponse;
-    ASSERT_EQ(pc->CreateAnswer(constraints, offer.c_str()), NS_OK);
+    ASSERT_EQ(pc->CreateAnswer(constraints, NS_OK);
     ASSERT_TRUE_WAIT(pObserver->state == TestObserver::stateSuccess, kDefaultTimeout);
     SDPSanityCheck(pObserver->lastString, audio, video, false);
     answer_ = pObserver->lastString;
   }
 
   void CreateOfferRemoveStream(sipcc::MediaConstraints& constraints, bool audio, bool video) {
 
     uint32_t aHintContents = 0;
@@ -675,47 +675,47 @@ public:
     a1_.SetLocal(TestObserver::OFFER, a1_.offer());
   }
 
   void OfferAnswer(sipcc::MediaConstraints& aconstraints, sipcc::MediaConstraints& bconstraints,
                        bool audio, bool video, bool finishAfterAnswer) {
     a1_.CreateOffer(aconstraints, audio, video);
     a1_.SetLocal(TestObserver::OFFER, a1_.offer());
     a2_.SetRemote(TestObserver::OFFER, a1_.offer());
-    a2_.CreateAnswer(bconstraints, a1_.offer(), audio, video);
+    a2_.CreateAnswer(bconstraints, audio, video);
     if(true == finishAfterAnswer) {
         a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
         a1_.SetRemote(TestObserver::ANSWER, a2_.answer());
 
         ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
         ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
     }
   }
 
   void OfferModifiedAnswer(sipcc::MediaConstraints& aconstraints, sipcc::MediaConstraints& bconstraints) {
     a1_.CreateOffer(aconstraints, true, true);
     a1_.SetLocal(TestObserver::OFFER, a1_.offer());
     a2_.SetRemote(TestObserver::OFFER, a1_.offer());
-    a2_.CreateAnswer(bconstraints, a1_.offer(), true, true);
+    a2_.CreateAnswer(bconstraints, true, true);
     a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
     ParsedSDP sdpWrapper(a2_.answer());
     sdpWrapper.ReplaceLine("m=audio", "m=audio 65375 RTP/SAVPF 109 8 101\r\n");
     sdpWrapper.AddLine("a=rtpmap:8 PCMA/8000\r\n");
     cout << "Modified SDP " << sdpWrapper.getSdp() << endl;
     a1_.SetRemote(TestObserver::ANSWER, sdpWrapper.getSdp());
     ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
     ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);
   }
 
   void OfferAnswerTrickle(sipcc::MediaConstraints& aconstraints, sipcc::MediaConstraints& bconstraints) {
     a1_.CreateOffer(aconstraints, true, true);
     a1_.SetLocal(TestObserver::OFFER, a1_.offer());
     ParsedSDP a1_offer(a1_.offer());
     a2_.SetRemote(TestObserver::OFFER, a1_offer.sdp_without_ice_);
-    a2_.CreateAnswer(bconstraints, a1_offer.sdp_without_ice_, true, true);
+    a2_.CreateAnswer(bconstraints, true, true);
     a2_.SetLocal(TestObserver::ANSWER, a2_.answer());
     ParsedSDP a2_answer(a2_.answer());
     a1_.SetRemote(TestObserver::ANSWER, a2_answer.sdp_without_ice_);
     // Now set the trickle ICE candidates
     a1_.DoTrickleIce(a2_answer);
     a2_.DoTrickleIce(a1_offer);
     ASSERT_TRUE_WAIT(a1_.IceCompleted() == true, kDefaultTimeout);
     ASSERT_TRUE_WAIT(a2_.IceCompleted() == true, kDefaultTimeout);