新增webrtc echo test双向会话示例

This commit is contained in:
ziyue
2021-10-16 10:52:28 +08:00
parent f0e896a5e2
commit 34365a2f8f
6 changed files with 95 additions and 1 deletions

View File

@@ -40,6 +40,7 @@
#ifdef ENABLE_WEBRTC
#include "../webrtc/WebRtcPlayer.h"
#include "../webrtc/WebRtcPusher.h"
#include "../webrtc/WebRtcEchoTest.h"
#endif
using namespace toolkit;
@@ -1271,6 +1272,14 @@ void installWebApi() {
return;
}
if (!strcasecmp(type.data(), "echo")) {
auto rtc = WebRtcEchoTest::create(EventPollerPool::Instance().getPoller());
val["sdp"] = rtc->getAnswerSdp(offer_sdp);
val["type"] = "answer";
invoker(200, headerOut, val.toStyledString());
return;
}
throw ApiRetException("不支持该类型", API::InvalidArgs);
});
#endif