Skip to content

Commit

Permalink
Fixed typo in stereo support in EchoTest plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed May 6, 2022
1 parent 204ef17 commit 95f6030
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions html/echotest.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ if(doSvc === "")
var acodec = (getQueryStringValue("acodec") !== "" ? getQueryStringValue("acodec") : null);
var vcodec = (getQueryStringValue("vcodec") !== "" ? getQueryStringValue("vcodec") : null);
var vprofile = (getQueryStringValue("vprofile") !== "" ? getQueryStringValue("vprofile") : null);
var stereo = false;
if(getQueryStringValue("stereo") !== "")
stereo = (getQueryStringValue("stereo") === "true");
var doDtx = (getQueryStringValue("dtx") === "yes" || getQueryStringValue("dtx") === "true");
var doOpusred = (getQueryStringValue("opusred") === "yes" || getQueryStringValue("opusred") === "true");
var simulcastStarted = false;
Expand Down Expand Up @@ -148,6 +151,10 @@ $(document).ready(function() {
jsep.sdp = jsep.sdp
.replace("useinbandfec=1", "useinbandfec=1;usedtx=1")
}
if(stereo && jsep.sdp.indexOf("stereo=1") == -1) {
// Make sure that our offer contains stereo too
jsep.sdp = jsep.sdp.replace("useinbandfec=1", "useinbandfec=1;stereo=1");
}
},
success: function(jsep) {
Janus.debug("Got SDP!", jsep);
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/janus_echotest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ static void *janus_echotest_handler(void *data) {
goto error;
}
/* Check if we need to negotiate Opus FEC and/or DTX */
gboolean opus_fec = FALSE, opus_dtx = FALSE;
gboolean opus_fec = FALSE, opus_dtx = FALSE, opus_stereo = FALSE;
char custom_fmtp[256];
custom_fmtp[0] = '\0';
GList *temp = offer->m_lines;
Expand Down Expand Up @@ -1114,11 +1114,11 @@ static void *janus_echotest_handler(void *data) {
}
}
if(strstr(a->value, "stereo=1")) {
opus_dtx = TRUE;
opus_stereo = TRUE;
if(strlen(custom_fmtp) == 0) {
g_snprintf(custom_fmtp, sizeof(custom_fmtp), "usedtx=1");
g_snprintf(custom_fmtp, sizeof(custom_fmtp), "stereo=1");
} else {
janus_strlcat(custom_fmtp, ";usedtx=1", sizeof(custom_fmtp));
g_strlcat(custom_fmtp, ";stereo=1", sizeof(custom_fmtp));
}
}
}
Expand All @@ -1136,7 +1136,7 @@ static void *janus_echotest_handler(void *data) {
JANUS_SDP_OA_MLINE, m->type,
JANUS_SDP_OA_CODEC, (m->type == JANUS_SDP_AUDIO ? json_string_value(audiocodec) :
(m->type == JANUS_SDP_VIDEO ? json_string_value(videocodec) : NULL)),
JANUS_SDP_OA_FMTP, ((m->type == JANUS_SDP_AUDIO && (opus_fec || opus_dtx)) ? custom_fmtp : NULL),
JANUS_SDP_OA_FMTP, ((m->type == JANUS_SDP_AUDIO && (opus_fec || opus_dtx || opus_stereo)) ? custom_fmtp : NULL),
JANUS_SDP_OA_ACCEPT_OPUSRED, (m->type == JANUS_SDP_AUDIO && json_is_true(opusred)),
JANUS_SDP_OA_VP9_PROFILE, json_string_value(videoprofile),
JANUS_SDP_OA_H264_PROFILE, json_string_value(videoprofile),
Expand Down

0 comments on commit 95f6030

Please sign in to comment.