mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
extmap支持方向
This commit is contained in:
parent
e670099192
commit
1228d07ff3
@ -447,15 +447,24 @@ string SdpAttrSetup::toString() const {
|
|||||||
|
|
||||||
void SdpAttrExtmap::parse(const string &str) {
|
void SdpAttrExtmap::parse(const string &str) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
if (sscanf(str.data(), "%" PRId32 " %127s", &index, buf) != 2) {
|
char direction_buf[32] = {0};
|
||||||
SDP_THROW();
|
if (sscanf(str.data(), "%" PRId32 "/%31[^ ] %127s", &index, direction_buf, buf) != 3) {
|
||||||
|
if (sscanf(str.data(), "%" PRId32 " %127s", &index, buf) != 2) {
|
||||||
|
SDP_THROW();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
direction = getRtpDirection(direction_buf);
|
||||||
}
|
}
|
||||||
ext = buf;
|
ext = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
string SdpAttrExtmap::toString() const {
|
string SdpAttrExtmap::toString() const {
|
||||||
if (value.empty()) {
|
if (value.empty()) {
|
||||||
value = to_string(index) + " " + ext;
|
if(direction == RtpDirection::invalid){
|
||||||
|
value = to_string(index) + " " + ext;
|
||||||
|
} else {
|
||||||
|
value = to_string(index) + "/" + getRtpDirectionString(direction) + " " + ext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return SdpItem::toString();
|
return SdpItem::toString();
|
||||||
}
|
}
|
||||||
@ -693,7 +702,7 @@ void test_sdp(){
|
|||||||
"a=fingerprint:sha-256 22:14:B5:AF:66:12:C7:C7:8D:EF:4B:DE:40:25:ED:5D:8F:17:54:DD:88:33:C0:13:2E:FD:1A:FA:7E:7A:1B:79\n"
|
"a=fingerprint:sha-256 22:14:B5:AF:66:12:C7:C7:8D:EF:4B:DE:40:25:ED:5D:8F:17:54:DD:88:33:C0:13:2E:FD:1A:FA:7E:7A:1B:79\n"
|
||||||
"a=setup:actpass\n"
|
"a=setup:actpass\n"
|
||||||
"a=mid:audio\n"
|
"a=mid:audio\n"
|
||||||
"a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\n"
|
"a=extmap:1/sendonly urn:ietf:params:rtp-hdrext:ssrc-audio-level\n"
|
||||||
"a=sendrecv\n"
|
"a=sendrecv\n"
|
||||||
"a=rtcp-mux\n"
|
"a=rtcp-mux\n"
|
||||||
"a=rtpmap:111 opus/48000/2\n"
|
"a=rtpmap:111 opus/48000/2\n"
|
||||||
|
@ -293,8 +293,9 @@ public:
|
|||||||
class SdpAttrExtmap : public SdpItem {
|
class SdpAttrExtmap : public SdpItem {
|
||||||
public:
|
public:
|
||||||
//https://aggresss.blog.csdn.net/article/details/106436703
|
//https://aggresss.blog.csdn.net/article/details/106436703
|
||||||
//a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
|
//a=extmap:1[/sendonly] urn:ietf:params:rtp-hdrext:ssrc-audio-level
|
||||||
int index;
|
int index;
|
||||||
|
RtpDirection direction{RtpDirection::invalid};
|
||||||
string ext;
|
string ext;
|
||||||
void parse(const string &str) override;
|
void parse(const string &str) override;
|
||||||
string toString() const override;
|
string toString() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user