for webapi startsendrtp can send raw rtp

This commit is contained in:
xgj
2022-04-01 18:28:09 +08:00
parent d5b8613858
commit 61625f458f
11 changed files with 205 additions and 18 deletions

View File

@@ -1104,7 +1104,10 @@ void installWebApi() {
if (!src) {
throw ApiRetException("该媒体流不存在", API::OtherFailed);
}
uint8_t pt = allArgs["pt"].empty() ? 96 : allArgs["pt"].as<uint8_t>();
bool use_ps = allArgs["use_ps"].empty() ? true : allArgs["use_ps"].as<bool>();
bool only_audio = allArgs["only_audio"].empty() ? true : allArgs["only_audio"].as<bool>();
//src_port为空时则随机本地端口
src->startSendRtp(allArgs["dst_url"], allArgs["dst_port"], allArgs["ssrc"], allArgs["is_udp"], allArgs["src_port"], [val, headerOut, invoker](uint16_t local_port, const SockException &ex) mutable{
if (ex) {
@@ -1113,7 +1116,7 @@ void installWebApi() {
}
val["local_port"] = local_port;
invoker(200, headerOut, val.toStyledString());
});
},pt,use_ps,only_audio);
});
api_regist("/index/api/stopSendRtp",[](API_ARGS_MAP){