Skip to content

Commit

Permalink
Merge pull request webrtc#621 from fippo/keep-offer-answer-objects-ar…
Browse files Browse the repository at this point in the history
…ound

munge-sdp: keep offer/answer objects around
  • Loading branch information
KaptenJansson committed Aug 24, 2015
2 parents ffe9775 + ce0d8a3 commit e67229f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/content/peerconnection/munge-sdp/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ createAnswerButton.onclick = createAnswer;
setAnswerButton.onclick = setAnswer;
hangupButton.onclick = hangup;

var offer;
var offerSdpTextarea = document.querySelector('div#local textarea');
var answer;
var answerSdpTextarea = document.querySelector('div#remote textarea');

var audioSelect = document.querySelector('select#audioSrc');
Expand Down Expand Up @@ -183,10 +185,8 @@ function onCreateSessionDescriptionError(error) {
function setOffer() {
var sdp = offerSdpTextarea.value;
sdp = maybeAddLineBreakToEnd(sdp);
var offer = new RTCSessionDescription({
type: 'offer',
sdp: sdp
});
sdp = sdp.replace(/\n/g, '\r\n');
offer.ѕdp = sdp;
localPeerConnection.setLocalDescription(offer,
onSetSessionDescriptionSuccess,
onSetSessionDescriptionError);
Expand All @@ -197,6 +197,7 @@ function setOffer() {
}

function gotDescription1(description) {
offer = description;
offerSdpTextarea.disabled = false;
offerSdpTextarea.value = description.sdp;
}
Expand All @@ -213,10 +214,8 @@ function createAnswer() {
function setAnswer() {
var sdp = answerSdpTextarea.value;
sdp = maybeAddLineBreakToEnd(sdp);
var answer = new RTCSessionDescription({
type: 'answer',
sdp: sdp
});
sdp = sdp.replace(/\n/g, '\r\n');
answer.sdp = sdp;
remotePeerConnection.setLocalDescription(answer,
onSetSessionDescriptionSuccess,
onSetSessionDescriptionError);
Expand All @@ -227,6 +226,7 @@ function setAnswer() {
}

function gotDescription2(description) {
answer = description;
answerSdpTextarea.disabled = false;
answerSdpTextarea.value = description.sdp;
}
Expand Down

0 comments on commit e67229f

Please sign in to comment.