Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
2a28bb32
提交
2a28bb32
authored
4月 01, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor RTP header extensions (change order, remove the now useless RTP extensions mapping)
上级
f93aae18
显示空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
301 行增加
和
364 行删除
+301
-364
ortc.js
lib/ortc.js
+0
-32
supportedRtpCapabilities.js
lib/supportedRtpCapabilities.js
+16
-16
test-Consumer.js
test/test-Consumer.js
+24
-24
test-PipeTransport.js
test/test-PipeTransport.js
+10
-10
test-ortc.js
test/test-ortc.js
+14
-20
compile_commands_template.json
worker/compile_commands_template.json
+5
-0
FuzzerRtpPacket.cpp
worker/fuzzer/src/RTC/FuzzerRtpPacket.cpp
+18
-18
Producer.hpp
worker/include/RTC/Producer.hpp
+0
-2
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+7
-7
RtpHeaderExtensionIds.hpp
worker/include/RTC/RtpHeaderExtensionIds.hpp
+4
-3
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+69
-69
AudioLevelObserver.cpp
worker/src/RTC/AudioLevelObserver.cpp
+1
-1
PlainRtpTransport.cpp
worker/src/RTC/PlainRtpTransport.cpp
+4
-4
Producer.cpp
worker/src/RTC/Producer.cpp
+78
-107
RtpHeaderExtensionUri.cpp
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
+5
-5
RtpPacket.cpp
worker/src/RTC/RtpPacket.cpp
+36
-36
Transport.cpp
worker/src/RTC/Transport.cpp
+3
-3
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+4
-4
TestRtpPacket.cpp
worker/test/src/RTC/TestRtpPacket.cpp
+3
-3
没有找到文件。
lib/ortc.js
浏览文件 @
2a28bb32
...
@@ -123,7 +123,6 @@ exports.generateRouterRtpCapabilities = function(mediaCodecs)
...
@@ -123,7 +123,6 @@ exports.generateRouterRtpCapabilities = function(mediaCodecs)
*
*
* @returns {Object} with codecs, headerExtensions and encodings arrays of objects.
* @returns {Object} with codecs, headerExtensions and encodings arrays of objects.
* Each codec has payloadType and mappedPayloadType.
* Each codec has payloadType and mappedPayloadType.
* Each headerExtension has id and mappedId.
* Each encoding may have rid and/or ssrc, and mandatory mappedSsrc.
* Each encoding may have rid and/or ssrc, and mandatory mappedSsrc.
* @throws {TypeError} if wrong arguments.
* @throws {TypeError} if wrong arguments.
* @throws {UnsupportedError} if codec not supported.
* @throws {UnsupportedError} if codec not supported.
...
@@ -134,7 +133,6 @@ exports.getProducerRtpParametersMapping = function(params, caps)
...
@@ -134,7 +133,6 @@ exports.getProducerRtpParametersMapping = function(params, caps)
const
rtpMapping
=
const
rtpMapping
=
{
{
codecs
:
[],
codecs
:
[],
headerExtensions
:
[],
encodings
:
[]
encodings
:
[]
};
};
...
@@ -209,25 +207,6 @@ exports.getProducerRtpParametersMapping = function(params, caps)
...
@@ -209,25 +207,6 @@ exports.getProducerRtpParametersMapping = function(params, caps)
});
});
}
}
// Generate header extensions mapping.
for
(
const
ext
of
(
params
.
headerExtensions
||
[]))
{
const
matchedCapExt
=
caps
.
headerExtensions
.
find
((
capExt
)
=>
matchHeaderExtensions
(
ext
,
capExt
));
if
(
!
matchedCapExt
)
{
throw
new
UnsupportedError
(
`unsupported header extensions [uri:"
${
ext
.
uri
}
", id:
${
ext
.
id
}
]`
);
}
rtpMapping
.
headerExtensions
.
push
(
{
id
:
ext
.
id
,
mappedId
:
matchedCapExt
.
preferredId
});
}
// Generate encodings mapping.
// Generate encodings mapping.
for
(
const
encoding
of
(
params
.
encodings
||
[]))
for
(
const
encoding
of
(
params
.
encodings
||
[]))
{
{
...
@@ -644,14 +623,3 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {})
...
@@ -644,14 +623,3 @@ function matchCodecs(aCodec, bCodec, { strict = false, modify = false } = {})
return
true
;
return
true
;
}
}
function
matchHeaderExtensions
(
aExt
,
bExt
)
{
if
(
aExt
.
kind
&&
bExt
.
kind
&&
aExt
.
kind
!==
bExt
.
kind
)
return
false
;
if
(
aExt
.
uri
!==
bExt
.
uri
)
return
false
;
return
true
;
}
lib/supportedRtpCapabilities.js
浏览文件 @
2a28bb32
...
@@ -197,55 +197,55 @@ const supportedRtpCapabilities =
...
@@ -197,55 +197,55 @@ const supportedRtpCapabilities =
[
[
{
{
kind
:
'audio'
,
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
preferredId
:
1
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:mid
'
,
preferredId
:
2
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
audi
o'
,
kind
:
'
vide
o'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
uri
:
'
urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id'
,
preferredId
:
3
,
preferredId
:
2
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
uri
:
'
urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id'
,
preferredId
:
3
,
preferredId
:
3
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
vide
o'
,
kind
:
'
audi
o'
,
uri
:
'
urn:3gpp:video-orientation'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
preferredId
:
4
,
preferredId
:
4
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
audi
o'
,
kind
:
'
vide
o'
,
uri
:
'
urn:ietf:params:rtp-hdrext:sdes:mid'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
preferredId
:
5
,
preferredId
:
4
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
vide
o'
,
kind
:
'
audi
o'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
preferredId
:
5
,
preferredId
:
5
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:
ietf:params:rtp-hdrext:sdes:rtp-stream-id
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
preferredId
:
6
,
preferredId
:
6
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:repaired-rtp-stream-id
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
preferredId
:
7
,
preferredId
:
7
,
preferredEncrypt
:
false
preferredEncrypt
:
false
}
}
...
...
test/test-Consumer.js
浏览文件 @
2a28bb32
...
@@ -190,50 +190,50 @@ const consumerDeviceCapabilities =
...
@@ -190,50 +190,50 @@ const consumerDeviceCapabilities =
[
[
{
{
kind
:
'audio'
,
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
preferredId
:
1
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:mid
'
,
preferredId
:
2
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
audi
o'
,
kind
:
'
vide
o'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
uri
:
'
urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id'
,
preferredId
:
3
,
preferredId
:
2
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'
vide
o'
,
kind
:
'
audi
o'
,
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
uri
:
'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
preferredId
:
3
,
preferredId
:
4
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'
urn:3gpp:video-orientation'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'
,
// eslint-disable-line max-len
preferredId
:
4
,
preferredId
:
4
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'audio'
,
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
preferredId
:
5
,
preferredId
:
5
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:
ietf:params:rtp-hdrext:sdes:mid
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
preferredId
:
5
,
preferredId
:
6
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:rtp-stream-id
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
preferredId
:
6
,
preferredId
:
7
,
preferredEncrypt
:
false
preferredEncrypt
:
false
}
}
],
],
...
@@ -495,14 +495,14 @@ test('consumer.dump() succeeds', async () =>
...
@@ -495,14 +495,14 @@ test('consumer.dump() succeeds', async () =>
expect
(
data
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
data
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'
urn:ietf:params:rtp-hdrext:ssrc-audio-level
'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
'
,
id
:
1
,
id
:
4
,
parameters
:
{},
parameters
:
{},
encrypt
:
false
encrypt
:
false
},
},
{
{
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
'
,
uri
:
'
urn:ietf:params:rtp-hdrext:ssrc-audio-level
'
,
id
:
3
,
id
:
5
,
parameters
:
{},
parameters
:
{},
encrypt
:
false
encrypt
:
false
}
}
...
@@ -556,20 +556,20 @@ test('consumer.dump() succeeds', async () =>
...
@@ -556,20 +556,20 @@ test('consumer.dump() succeeds', async () =>
expect
(
data
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
data
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'
urn:ietf:params:rtp-hdrext:toffset
'
,
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
'
,
id
:
2
,
id
:
4
,
parameters
:
{},
parameters
:
{},
encrypt
:
false
encrypt
:
false
},
},
{
{
uri
:
'
http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
'
,
uri
:
'
urn:3gpp:video-orientation
'
,
id
:
3
,
id
:
6
,
parameters
:
{},
parameters
:
{},
encrypt
:
false
encrypt
:
false
},
},
{
{
uri
:
'urn:
3gpp:video-orientation
'
,
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
id
:
4
,
id
:
7
,
parameters
:
{},
parameters
:
{},
encrypt
:
false
encrypt
:
false
}
}
...
...
test/test-PipeTransport.js
浏览文件 @
2a28bb32
...
@@ -231,7 +231,7 @@ test('router.pipeToRouter() succeeds with audio', async () =>
...
@@ -231,7 +231,7 @@ test('router.pipeToRouter() succeeds with audio', async () =>
[
[
{
{
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
id
:
1
id
:
5
}
}
]);
]);
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -268,7 +268,7 @@ test('router.pipeToRouter() succeeds with audio', async () =>
...
@@ -268,7 +268,7 @@ test('router.pipeToRouter() succeeds with audio', async () =>
[
[
{
{
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
uri
:
'urn:ietf:params:rtp-hdrext:ssrc-audio-level'
,
id
:
1
id
:
5
}
}
]);
]);
expect
(
pipeProducer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeProducer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -319,12 +319,12 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -319,12 +319,12 @@ test('router.pipeToRouter() succeeds with video', async () =>
expect
(
pipeConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
id
:
2
id
:
6
},
},
{
{
uri
:
'urn:
3gpp:video-orientation
'
,
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
id
:
4
id
:
7
}
}
]);
]);
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
expect
(
pipeConsumer
.
rtpParameters
.
encodings
).
toEqual
(
...
@@ -361,12 +361,12 @@ test('router.pipeToRouter() succeeds with video', async () =>
...
@@ -361,12 +361,12 @@ test('router.pipeToRouter() succeeds with video', async () =>
expect
(
pipeProducer
.
rtpParameters
.
headerExtensions
).
toEqual
(
expect
(
pipeProducer
.
rtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
id
:
2
id
:
6
},
},
{
{
uri
:
'urn:
3gpp:video-orientation
'
,
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
id
:
4
id
:
7
}
}
]);
]);
expect
(
pipeProducer
.
paused
).
toBe
(
true
);
expect
(
pipeProducer
.
paused
).
toBe
(
true
);
...
...
test/test-ortc.js
浏览文件 @
2a28bb32
...
@@ -283,12 +283,6 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
...
@@ -283,12 +283,6 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
{
payloadType
:
112
,
mappedPayloadType
:
102
}
{
payloadType
:
112
,
mappedPayloadType
:
102
}
]);
]);
expect
(
rtpMapping
.
headerExtensions
).
toEqual
(
[
{
id
:
1
,
mappedId
:
5
},
{
id
:
2
,
mappedId
:
4
}
]);
expect
(
rtpMapping
.
encodings
[
0
].
ssrc
).
toBe
(
11111111
);
expect
(
rtpMapping
.
encodings
[
0
].
ssrc
).
toBe
(
11111111
);
expect
(
rtpMapping
.
encodings
[
0
].
rid
).
toBe
(
undefined
);
expect
(
rtpMapping
.
encodings
[
0
].
rid
).
toBe
(
undefined
);
expect
(
rtpMapping
.
encodings
[
0
].
mappedSsrc
).
toBeType
(
'number'
);
expect
(
rtpMapping
.
encodings
[
0
].
mappedSsrc
).
toBeType
(
'number'
);
...
@@ -384,38 +378,38 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
...
@@ -384,38 +378,38 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
[
[
{
{
kind
:
'audio'
,
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
preferredId
:
1
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:mid
'
,
preferredId
:
2
,
preferredId
:
1
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:
3gpp:video-orientation
'
,
uri
:
'urn:
ietf:params:rtp-hdrext:sdes:rtp-stream-id
'
,
preferredId
:
4
,
preferredId
:
2
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'audio'
,
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
des:mid
'
,
uri
:
'urn:ietf:params:rtp-hdrext:s
src-audio-level
'
,
preferredId
:
5
,
preferredId
:
5
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:
ietf:params:rtp-hdrext:sdes:mid
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
preferredId
:
5
,
preferredId
:
6
,
preferredEncrypt
:
false
preferredEncrypt
:
false
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:
sdes:rtp-stream-id
'
,
uri
:
'urn:ietf:params:rtp-hdrext:
toffset
'
,
preferredId
:
6
,
preferredId
:
7
,
preferredEncrypt
:
false
preferredEncrypt
:
false
}
}
]
]
...
@@ -463,12 +457,12 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
...
@@ -463,12 +457,12 @@ test('getProducerRtpParametersMapping(), getConsumableRtpParameters(), getConsum
expect
(
consumerRtpParameters
.
headerExtensions
).
toEqual
(
expect
(
consumerRtpParameters
.
headerExtensions
).
toEqual
(
[
[
{
{
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
uri
:
'urn:
3gpp:video-orientation
'
,
id
:
2
id
:
6
},
},
{
{
uri
:
'urn:
3gpp:video-orientation
'
,
uri
:
'urn:
ietf:params:rtp-hdrext:toffset
'
,
id
:
4
id
:
7
}
}
]);
]);
...
...
worker/compile_commands_template.json
浏览文件 @
2a28bb32
...
@@ -404,6 +404,11 @@
...
@@ -404,6 +404,11 @@
"directory"
:
"PATH/out"
,
"directory"
:
"PATH/out"
,
"file"
:
"PATH/src/RTC/RTCP/FeedbackPsRemb.cpp"
"file"
:
"PATH/src/RTC/RTCP/FeedbackPsRemb.cpp"
},
},
{
"command"
:
"c++ -c -DMS_LITTLE_ENDIAN -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_INT16_T -DHAVE_INT32_T -DHAVE_INT8_T -DHAVE_UINT16_T -DHAVE_UINT32_T -DHAVE_UINT64_T -DHAVE_UINT8_T -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DCPU_CISC -IPATH/include -IPATH/deps/netstring/netstring-c -IPATH/deps/libuv/include -IPATH/deps/openssl/openssl/include -IPATH/deps/libsrtp/srtp/include -std=c++11 -Wall -Wextra -Wno-unused-parameter -m64 -g -o PATH/out/Release/obj.target/mediasoup-worker/src/RTC/RembClient.o PATH/src/RTC/RembClient.cpp"
,
"directory"
:
"PATH/out"
,
"file"
:
"PATH/src/RTC/RembClient.cpp"
},
{
{
"command"
:
"c++ -c -DMS_LITTLE_ENDIAN -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_INT16_T -DHAVE_INT32_T -DHAVE_INT8_T -DHAVE_UINT16_T -DHAVE_UINT32_T -DHAVE_UINT64_T -DHAVE_UINT8_T -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DCPU_CISC -IPATH/include -IPATH/deps/netstring/netstring-c -IPATH/deps/libuv/include -IPATH/deps/openssl/openssl/include -IPATH/deps/libsrtp/srtp/include -std=c++11 -Wall -Wextra -Wno-unused-parameter -m64 -g -o PATH/out/Release/obj.target/mediasoup-worker/src/RTC/RembServer/AimdRateControl.o PATH/src/RTC/RembServer/AimdRateControl.cpp"
,
"command"
:
"c++ -c -DMS_LITTLE_ENDIAN -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_INT16_T -DHAVE_INT32_T -DHAVE_INT8_T -DHAVE_UINT16_T -DHAVE_UINT32_T -DHAVE_UINT64_T -DHAVE_UINT8_T -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DCPU_CISC -IPATH/include -IPATH/deps/netstring/netstring-c -IPATH/deps/libuv/include -IPATH/deps/openssl/openssl/include -IPATH/deps/libsrtp/srtp/include -std=c++11 -Wall -Wextra -Wno-unused-parameter -m64 -g -o PATH/out/Release/obj.target/mediasoup-worker/src/RTC/RembServer/AimdRateControl.o PATH/src/RTC/RembServer/AimdRateControl.cpp"
,
"directory"
:
"PATH/out"
,
"directory"
:
"PATH/out"
,
...
...
worker/fuzzer/src/RTC/FuzzerRtpPacket.cpp
浏览文件 @
2a28bb32
...
@@ -53,18 +53,6 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
...
@@ -53,18 +53,6 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
packet
->
HasOneByteExtensions
();
packet
->
HasOneByteExtensions
();
packet
->
HasTwoBytesExtensions
();
packet
->
HasTwoBytesExtensions
();
packet
->
SetAudioLevelExtensionId
(
1
);
packet
->
GetExtension
(
1
,
extenLen
);
packet
->
ReadAudioLevel
(
volume
,
voice
);
packet
->
SetVideoOrientationExtensionId
(
2
);
packet
->
GetExtension
(
2
,
extenLen
);
packet
->
ReadVideoOrientation
(
camera
,
flip
,
rotation
);
packet
->
SetAbsSendTimeExtensionId
(
3
);
packet
->
GetExtension
(
3
,
extenLen
);
packet
->
ReadAbsSendTime
(
absSendTime
);
packet
->
SetMidExtensionId
(
5
);
packet
->
SetMidExtensionId
(
5
);
packet
->
GetExtension
(
5
,
extenLen
);
packet
->
GetExtension
(
5
,
extenLen
);
packet
->
ReadMid
(
mid
);
packet
->
ReadMid
(
mid
);
...
@@ -73,6 +61,18 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
...
@@ -73,6 +61,18 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
packet
->
GetExtension
(
6
,
extenLen
);
packet
->
GetExtension
(
6
,
extenLen
);
packet
->
ReadRid
(
rid
);
packet
->
ReadRid
(
rid
);
packet
->
SetAbsSendTimeExtensionId
(
3
);
packet
->
GetExtension
(
3
,
extenLen
);
packet
->
ReadAbsSendTime
(
absSendTime
);
packet
->
SetSsrcAudioLevelExtensionId
(
1
);
packet
->
GetExtension
(
1
,
extenLen
);
packet
->
ReadSsrcAudioLevel
(
volume
,
voice
);
packet
->
SetVideoOrientationExtensionId
(
2
);
packet
->
GetExtension
(
2
,
extenLen
);
packet
->
ReadVideoOrientation
(
camera
,
flip
,
rotation
);
uint8_t
value1
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
};
uint8_t
value1
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
};
extensions
.
emplace_back
(
extensions
.
emplace_back
(
...
@@ -126,18 +126,18 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
...
@@ -126,18 +126,18 @@ void Fuzzer::RTC::RtpPacket::Fuzz(const uint8_t* data, size_t len)
packet
->
SetExtensions
(
2
,
extensions
);
packet
->
SetExtensions
(
2
,
extensions
);
packet
->
SetExtensions
(
1
,
extensions
);
packet
->
SetExtensions
(
1
,
extensions
);
packet
->
SetAudioLevelExtensionId
(
11
);
packet
->
SetAbsSendTimeExtensionId
(
13
);
packet
->
GetExtension
(
13
,
extenLen
);
packet
->
ReadAbsSendTime
(
absSendTime
);
packet
->
SetSsrcAudioLevelExtensionId
(
11
);
packet
->
GetExtension
(
11
,
extenLen
);
packet
->
GetExtension
(
11
,
extenLen
);
packet
->
ReadAudioLevel
(
volume
,
voice
);
packet
->
Read
Ssrc
AudioLevel
(
volume
,
voice
);
packet
->
SetVideoOrientationExtensionId
(
12
);
packet
->
SetVideoOrientationExtensionId
(
12
);
packet
->
GetExtension
(
12
,
extenLen
);
packet
->
GetExtension
(
12
,
extenLen
);
packet
->
ReadVideoOrientation
(
camera
,
flip
,
rotation
);
packet
->
ReadVideoOrientation
(
camera
,
flip
,
rotation
);
packet
->
SetAbsSendTimeExtensionId
(
13
);
packet
->
GetExtension
(
13
,
extenLen
);
packet
->
ReadAbsSendTime
(
absSendTime
);
packet
->
GetPayload
();
packet
->
GetPayload
();
packet
->
GetPayloadLength
();
packet
->
GetPayloadLength
();
packet
->
GetPayloadPadding
();
packet
->
GetPayloadPadding
();
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
2a28bb32
...
@@ -49,7 +49,6 @@ namespace RTC
...
@@ -49,7 +49,6 @@ namespace RTC
struct
RtpMapping
struct
RtpMapping
{
{
std
::
map
<
uint8_t
,
uint8_t
>
codecs
;
std
::
map
<
uint8_t
,
uint8_t
>
codecs
;
std
::
map
<
uint8_t
,
uint8_t
>
headerExtensions
;
std
::
vector
<
RtpEncodingMapping
>
encodings
;
std
::
vector
<
RtpEncodingMapping
>
encodings
;
};
};
...
@@ -118,7 +117,6 @@ namespace RTC
...
@@ -118,7 +117,6 @@ namespace RTC
std
::
map
<
RTC
::
RtpStreamRecv
*
,
uint32_t
>
mapRtpStreamMappedSsrc
;
std
::
map
<
RTC
::
RtpStreamRecv
*
,
uint32_t
>
mapRtpStreamMappedSsrc
;
std
::
map
<
uint32_t
,
uint32_t
>
mapMappedSsrcSsrc
;
std
::
map
<
uint32_t
,
uint32_t
>
mapMappedSsrcSsrc
;
struct
RTC
::
RtpHeaderExtensionIds
rtpHeaderExtensionIds
;
struct
RTC
::
RtpHeaderExtensionIds
rtpHeaderExtensionIds
;
struct
RTC
::
RtpHeaderExtensionIds
mappedRtpHeaderExtensionIds
;
bool
paused
{
false
};
bool
paused
{
false
};
// Timestamp when last RTCP was sent.
// Timestamp when last RTCP was sent.
uint64_t
lastRtcpSentTime
{
0
};
uint64_t
lastRtcpSentTime
{
0
};
...
...
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
2a28bb32
...
@@ -127,13 +127,13 @@ namespace RTC
...
@@ -127,13 +127,13 @@ namespace RTC
enum
class
Type
:
uint8_t
enum
class
Type
:
uint8_t
{
{
UNKNOWN
=
0
,
UNKNOWN
=
0
,
SSRC_AUDIO_LEVEL
=
1
,
MID
=
1
,
TO_OFFSET
=
2
,
RTP_STREAM_ID
=
2
,
ABS_SEND_TIME
=
3
,
REPAIRED_RTP_STREAM_ID
=
3
,
VIDEO_ORIENTATION
=
4
,
ABS_SEND_TIME
=
4
,
MID
=
5
,
SSRC_AUDIO_LEVEL
=
5
,
RTP_STREAM_ID
=
6
,
VIDEO_ORIENTATION
=
6
,
REPAIRED_RTP_STREAM_ID
=
7
TOFFSET
=
7
};
};
private
:
private
:
...
...
worker/include/RTC/RtpHeaderExtensionIds.hpp
浏览文件 @
2a28bb32
...
@@ -7,12 +7,13 @@ namespace RTC
...
@@ -7,12 +7,13 @@ namespace RTC
// the same Transport. Others are different for each Producer.
// the same Transport. Others are different for each Producer.
struct
RtpHeaderExtensionIds
struct
RtpHeaderExtensionIds
{
{
uint8_t
ssrcAudioLevel
{
0u
};
// 0 means no ssrc-audio-level id.
uint8_t
videoOrientation
{
0u
};
// 0 means no video-orientation id.
uint8_t
absSendTime
{
0u
};
// 0 means no abs-send-time id.
uint8_t
mid
{
0u
};
// 0 means no MID id.
uint8_t
mid
{
0u
};
// 0 means no MID id.
uint8_t
rid
{
0u
};
// 0 means no RID id.
uint8_t
rid
{
0u
};
// 0 means no RID id.
uint8_t
rrid
{
0u
};
// 0 means no RRID id.
uint8_t
rrid
{
0u
};
// 0 means no RRID id.
uint8_t
absSendTime
{
0u
};
// 0 means no abs-send-time id.
uint8_t
ssrcAudioLevel
{
0u
};
// 0 means no ssrc-audio-level id.
uint8_t
videoOrientation
{
0u
};
// 0 means no video-orientation id.
uint8_t
toffset
{
0u
};
// 0 means no toffset id.
};
};
}
// namespace RTC
}
// namespace RTC
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
2a28bb32
...
@@ -122,17 +122,17 @@ namespace RTC
...
@@ -122,17 +122,17 @@ namespace RTC
uint8_t
*
GetHeaderExtensionValue
()
const
;
uint8_t
*
GetHeaderExtensionValue
()
const
;
bool
HasOneByteExtensions
()
const
;
bool
HasOneByteExtensions
()
const
;
bool
HasTwoBytesExtensions
()
const
;
bool
HasTwoBytesExtensions
()
const
;
void
SetAudioLevelExtensionId
(
uint8_t
id
);
void
SetVideoOrientationExtensionId
(
uint8_t
id
);
void
SetAbsSendTimeExtensionId
(
uint8_t
id
);
void
SetMidExtensionId
(
uint8_t
id
);
void
SetMidExtensionId
(
uint8_t
id
);
void
SetRidExtensionId
(
uint8_t
id
);
void
SetRidExtensionId
(
uint8_t
id
);
void
SetRepairedRidExtensionId
(
uint8_t
id
);
void
SetRepairedRidExtensionId
(
uint8_t
id
);
bool
ReadAudioLevel
(
uint8_t
&
volume
,
bool
&
voice
)
const
;
void
SetAbsSendTimeExtensionId
(
uint8_t
id
)
;
bool
ReadVideoOrientation
(
bool
&
camera
,
bool
&
flip
,
uint16_t
&
rotation
)
const
;
void
SetSsrcAudioLevelExtensionId
(
uint8_t
id
)
;
bool
ReadAbsSendTime
(
uint32_t
&
time
)
const
;
void
SetVideoOrientationExtensionId
(
uint8_t
id
)
;
bool
ReadMid
(
std
::
string
&
mid
)
const
;
bool
ReadMid
(
std
::
string
&
mid
)
const
;
bool
ReadRid
(
std
::
string
&
rid
)
const
;
bool
ReadRid
(
std
::
string
&
rid
)
const
;
bool
ReadAbsSendTime
(
uint32_t
&
time
)
const
;
bool
ReadSsrcAudioLevel
(
uint8_t
&
volume
,
bool
&
voice
)
const
;
bool
ReadVideoOrientation
(
bool
&
camera
,
bool
&
flip
,
uint16_t
&
rotation
)
const
;
uint8_t
*
GetExtension
(
uint8_t
id
,
uint8_t
&
len
)
const
;
uint8_t
*
GetExtension
(
uint8_t
id
,
uint8_t
&
len
)
const
;
uint8_t
*
GetPayload
()
const
;
uint8_t
*
GetPayload
()
const
;
size_t
GetPayloadLength
()
const
;
size_t
GetPayloadLength
()
const
;
...
@@ -156,12 +156,12 @@ namespace RTC
...
@@ -156,12 +156,12 @@ namespace RTC
HeaderExtension
*
headerExtension
{
nullptr
};
HeaderExtension
*
headerExtension
{
nullptr
};
std
::
map
<
uint8_t
,
OneByteExtension
*>
mapOneByteExtensions
;
std
::
map
<
uint8_t
,
OneByteExtension
*>
mapOneByteExtensions
;
std
::
map
<
uint8_t
,
TwoBytesExtension
*>
mapTwoBytesExtensions
;
std
::
map
<
uint8_t
,
TwoBytesExtension
*>
mapTwoBytesExtensions
;
uint8_t
audioLevelExtensionId
{
0
};
uint8_t
videoOrientationExtensionId
{
0
};
uint8_t
absSendTimeExtensionId
{
0
};
uint8_t
midExtensionId
{
0
};
uint8_t
midExtensionId
{
0
};
uint8_t
ridExtensionId
{
0
};
uint8_t
ridExtensionId
{
0
};
uint8_t
rridExtensionId
{
0
};
uint8_t
rridExtensionId
{
0
};
uint8_t
absSendTimeExtensionId
{
0
};
uint8_t
ssrcAudioLevelExtensionId
{
0
};
uint8_t
videoOrientationExtensionId
{
0
};
uint8_t
*
payload
{
nullptr
};
uint8_t
*
payload
{
nullptr
};
size_t
payloadLength
{
0
};
size_t
payloadLength
{
0
};
uint8_t
payloadPadding
{
0
};
uint8_t
payloadPadding
{
0
};
...
@@ -292,104 +292,92 @@ namespace RTC
...
@@ -292,104 +292,92 @@ namespace RTC
return
(
GetHeaderExtensionId
()
&
0
b1111111111110000
)
==
0
b0001000000000000
;
return
(
GetHeaderExtensionId
()
&
0
b1111111111110000
)
==
0
b0001000000000000
;
}
}
inline
void
RtpPacket
::
Set
AudioLevel
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
Mid
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
audioLevel
ExtensionId
=
id
;
this
->
mid
ExtensionId
=
id
;
}
}
inline
void
RtpPacket
::
Set
VideoOrientation
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
Rid
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
videoOrientation
ExtensionId
=
id
;
this
->
rid
ExtensionId
=
id
;
}
}
inline
void
RtpPacket
::
Set
AbsSendTime
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
RepairedRid
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
absSendTime
ExtensionId
=
id
;
this
->
rrid
ExtensionId
=
id
;
}
}
inline
void
RtpPacket
::
Set
Mid
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
AbsSendTime
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
mid
ExtensionId
=
id
;
this
->
absSendTime
ExtensionId
=
id
;
}
}
inline
void
RtpPacket
::
Set
Rid
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
SsrcAudioLevel
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
rid
ExtensionId
=
id
;
this
->
ssrcAudioLevel
ExtensionId
=
id
;
}
}
inline
void
RtpPacket
::
Set
RepairedRid
ExtensionId
(
uint8_t
id
)
inline
void
RtpPacket
::
Set
VideoOrientation
ExtensionId
(
uint8_t
id
)
{
{
if
(
id
==
0u
)
if
(
id
==
0u
)
return
;
return
;
this
->
rrid
ExtensionId
=
id
;
this
->
videoOrientation
ExtensionId
=
id
;
}
}
inline
bool
RtpPacket
::
Read
AudioLevel
(
uint8_t
&
volume
,
bool
&
voice
)
const
inline
bool
RtpPacket
::
Read
Mid
(
std
::
string
&
mid
)
const
{
{
uint8_t
extenLen
;
uint8_t
extenLen
;
uint8_t
*
extenValue
=
GetExtension
(
this
->
audioLevel
ExtensionId
,
extenLen
);
uint8_t
*
extenValue
=
GetExtension
(
this
->
mid
ExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
1
)
if
(
!
extenValue
||
extenLen
==
0
)
return
false
;
return
false
;
volume
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
mid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
voice
=
(
volume
&
(
1
<<
7
))
?
true
:
false
;
volume
&=
~
(
1
<<
7
);
return
true
;
return
true
;
}
}
inline
bool
RtpPacket
::
Read
VideoOrientation
(
bool
&
camera
,
bool
&
flip
,
uint16_t
&
rotation
)
const
inline
bool
RtpPacket
::
Read
Rid
(
std
::
string
&
rid
)
const
{
{
// First try with the RID id then with the Repaired RID id.
uint8_t
extenLen
;
uint8_t
extenLen
;
uint8_t
*
extenValue
=
GetExtension
(
this
->
videoOrientation
ExtensionId
,
extenLen
);
uint8_t
*
extenValue
=
GetExtension
(
this
->
rid
ExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
!=
1
)
if
(
extenValue
&&
extenLen
>
0
)
return
false
;
{
rid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
uint8_t
cvoByte
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
return
true
;
uint8_t
cameraValue
=
((
cvoByte
&
0
b00001000
)
>>
3
);
}
uint8_t
flipValue
=
((
cvoByte
&
0
b00000100
)
>>
2
);
uint8_t
rotationValue
=
(
cvoByte
&
0
b00000011
);
camera
=
cameraValue
?
true
:
false
;
extenValue
=
GetExtension
(
this
->
rridExtensionId
,
extenLen
);
flip
=
flipValue
?
true
:
false
;
// Using counter clockwise values.
if
(
extenValue
&&
extenLen
>
0
)
switch
(
rotationValue
)
{
{
case
3
:
rid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
rotation
=
270
;
break
;
case
2
:
rotation
=
180
;
break
;
case
1
:
rotation
=
90
;
break
;
default
:
rotation
=
0
;
}
return
true
;
return
true
;
}
}
return
false
;
}
inline
bool
RtpPacket
::
ReadAbsSendTime
(
uint32_t
&
time
)
const
inline
bool
RtpPacket
::
ReadAbsSendTime
(
uint32_t
&
time
)
const
{
{
uint8_t
extenLen
;
uint8_t
extenLen
;
...
@@ -403,42 +391,54 @@ namespace RTC
...
@@ -403,42 +391,54 @@ namespace RTC
return
true
;
return
true
;
}
}
inline
bool
RtpPacket
::
Read
Mid
(
std
::
string
&
mid
)
const
inline
bool
RtpPacket
::
Read
SsrcAudioLevel
(
uint8_t
&
volume
,
bool
&
voice
)
const
{
{
uint8_t
extenLen
;
uint8_t
extenLen
;
uint8_t
*
extenValue
=
GetExtension
(
this
->
mid
ExtensionId
,
extenLen
);
uint8_t
*
extenValue
=
GetExtension
(
this
->
ssrcAudioLevel
ExtensionId
,
extenLen
);
if
(
!
extenValue
||
extenLen
==
0
)
if
(
!
extenValue
||
extenLen
!=
1
)
return
false
;
return
false
;
mid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
volume
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
voice
=
(
volume
&
(
1
<<
7
))
?
true
:
false
;
volume
&=
~
(
1
<<
7
);
return
true
;
return
true
;
}
}
inline
bool
RtpPacket
::
Read
Rid
(
std
::
string
&
rid
)
const
inline
bool
RtpPacket
::
Read
VideoOrientation
(
bool
&
camera
,
bool
&
flip
,
uint16_t
&
rotation
)
const
{
{
// First try with the RID id then with the Repaired RID id.
uint8_t
extenLen
;
uint8_t
extenLen
;
uint8_t
*
extenValue
=
GetExtension
(
this
->
rid
ExtensionId
,
extenLen
);
uint8_t
*
extenValue
=
GetExtension
(
this
->
videoOrientation
ExtensionId
,
extenLen
);
if
(
extenValue
&&
extenLen
>
0
)
if
(
!
extenValue
||
extenLen
!=
1
)
{
return
false
;
rid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
return
true
;
uint8_t
cvoByte
=
Utils
::
Byte
::
Get1Byte
(
extenValue
,
0
);
}
uint8_t
cameraValue
=
((
cvoByte
&
0
b00001000
)
>>
3
);
uint8_t
flipValue
=
((
cvoByte
&
0
b00000100
)
>>
2
);
uint8_t
rotationValue
=
(
cvoByte
&
0
b00000011
);
extenValue
=
GetExtension
(
this
->
rridExtensionId
,
extenLen
);
camera
=
cameraValue
?
true
:
false
;
flip
=
flipValue
?
true
:
false
;
if
(
extenValue
&&
extenLen
>
0
)
// Using counter clockwise values.
switch
(
rotationValue
)
{
{
rid
.
assign
(
reinterpret_cast
<
const
char
*>
(
extenValue
),
static_cast
<
size_t
>
(
extenLen
));
case
3
:
rotation
=
270
;
return
true
;
break
;
case
2
:
rotation
=
180
;
break
;
case
1
:
rotation
=
90
;
break
;
default
:
rotation
=
0
;
}
}
return
fals
e
;
return
tru
e
;
}
}
inline
uint8_t
*
RtpPacket
::
GetExtension
(
uint8_t
id
,
uint8_t
&
len
)
const
inline
uint8_t
*
RtpPacket
::
GetExtension
(
uint8_t
id
,
uint8_t
&
len
)
const
...
...
worker/src/RTC/AudioLevelObserver.cpp
浏览文件 @
2a28bb32
...
@@ -90,7 +90,7 @@ namespace RTC
...
@@ -90,7 +90,7 @@ namespace RTC
uint8_t
volume
;
uint8_t
volume
;
bool
voice
;
bool
voice
;
if
(
!
packet
->
ReadAudioLevel
(
volume
,
voice
))
if
(
!
packet
->
Read
Ssrc
AudioLevel
(
volume
,
voice
))
return
;
return
;
auto
&
dBovs
=
this
->
mapProducerDBovs
.
at
(
producer
);
auto
&
dBovs
=
this
->
mapProducerDBovs
.
at
(
producer
);
...
...
worker/src/RTC/PlainRtpTransport.cpp
浏览文件 @
2a28bb32
...
@@ -185,9 +185,6 @@ namespace RTC
...
@@ -185,9 +185,6 @@ namespace RTC
jsonObject
[
"rtpHeaderExtensions"
]
=
json
::
object
();
jsonObject
[
"rtpHeaderExtensions"
]
=
json
::
object
();
auto
jsonRtpHeaderExtensionsIt
=
jsonObject
.
find
(
"rtpHeaderExtensions"
);
auto
jsonRtpHeaderExtensionsIt
=
jsonObject
.
find
(
"rtpHeaderExtensions"
);
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"absSendTime"
]
=
this
->
rtpHeaderExtensionIds
.
absSendTime
;
if
(
this
->
rtpHeaderExtensionIds
.
mid
!=
0u
)
if
(
this
->
rtpHeaderExtensionIds
.
mid
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"mid"
]
=
this
->
rtpHeaderExtensionIds
.
mid
;
(
*
jsonRtpHeaderExtensionsIt
)[
"mid"
]
=
this
->
rtpHeaderExtensionIds
.
mid
;
...
@@ -197,6 +194,9 @@ namespace RTC
...
@@ -197,6 +194,9 @@ namespace RTC
if
(
this
->
rtpHeaderExtensionIds
.
rrid
!=
0u
)
if
(
this
->
rtpHeaderExtensionIds
.
rrid
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"rrid"
]
=
this
->
rtpHeaderExtensionIds
.
rrid
;
(
*
jsonRtpHeaderExtensionsIt
)[
"rrid"
]
=
this
->
rtpHeaderExtensionIds
.
rrid
;
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"absSendTime"
]
=
this
->
rtpHeaderExtensionIds
.
absSendTime
;
// Add rtpListener.
// Add rtpListener.
this
->
rtpListener
.
FillJson
(
jsonObject
[
"rtpListener"
]);
this
->
rtpListener
.
FillJson
(
jsonObject
[
"rtpListener"
]);
}
}
...
@@ -548,10 +548,10 @@ namespace RTC
...
@@ -548,10 +548,10 @@ namespace RTC
}
}
// Apply the Transport RTP header extension ids so the RTP listener can use them.
// Apply the Transport RTP header extension ids so the RTP listener can use them.
packet
->
SetAbsSendTimeExtensionId
(
this
->
rtpHeaderExtensionIds
.
absSendTime
);
packet
->
SetMidExtensionId
(
this
->
rtpHeaderExtensionIds
.
mid
);
packet
->
SetMidExtensionId
(
this
->
rtpHeaderExtensionIds
.
mid
);
packet
->
SetRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rid
);
packet
->
SetRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rid
);
packet
->
SetRepairedRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rrid
);
packet
->
SetRepairedRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rrid
);
packet
->
SetAbsSendTimeExtensionId
(
this
->
rtpHeaderExtensionIds
.
absSendTime
);
// Get the associated Producer.
// Get the associated Producer.
RTC
::
Producer
*
producer
=
this
->
rtpListener
.
GetProducer
(
packet
);
RTC
::
Producer
*
producer
=
this
->
rtpListener
.
GetProducer
(
packet
);
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
2a28bb32
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
// #define MS_LOG_DEV
// #define MS_LOG_DEV
#include "RTC/Producer.hpp"
#include "RTC/Producer.hpp"
#include "DepLibUV.hpp"
#include "Logger.hpp"
#include "Logger.hpp"
#include "MediaSoupErrors.hpp"
#include "MediaSoupErrors.hpp"
#include "Utils.hpp"
#include "Channel/Notifier.hpp"
#include "Channel/Notifier.hpp"
#include <cstring> // std::memcpy()
#include <cstring> // std::memcpy()
...
@@ -67,29 +69,6 @@ namespace RTC
...
@@ -67,29 +69,6 @@ namespace RTC
jsonMappedPayloadTypeIt
->
get
<
uint8_t
>
();
jsonMappedPayloadTypeIt
->
get
<
uint8_t
>
();
}
}
auto
jsonHeaderExtensionsIt
=
jsonRtpMappingIt
->
find
(
"headerExtensions"
);
if
(
jsonHeaderExtensionsIt
==
jsonRtpMappingIt
->
end
()
||
!
jsonHeaderExtensionsIt
->
is_array
())
MS_THROW_TYPE_ERROR
(
"missing rtpMapping.headerExtensions"
);
for
(
auto
&
extension
:
*
jsonHeaderExtensionsIt
)
{
if
(
!
extension
.
is_object
())
MS_THROW_TYPE_ERROR
(
"wrong entry in rtpMapping.headerExtensions (not an object)"
);
auto
jsonIdIt
=
extension
.
find
(
"id"
);
if
(
jsonIdIt
==
extension
.
end
()
||
!
jsonIdIt
->
is_number_unsigned
())
MS_THROW_TYPE_ERROR
(
"wrong entry in rtpMapping.headerExtensions (missing id)"
);
auto
jsonMappedIdIt
=
extension
.
find
(
"mappedId"
);
if
(
jsonMappedIdIt
==
extension
.
end
()
||
!
jsonMappedIdIt
->
is_number_unsigned
())
MS_THROW_TYPE_ERROR
(
"wrong entry in rtpMapping.headerExtensions (missing mappedId)"
);
this
->
rtpMapping
.
headerExtensions
[
jsonIdIt
->
get
<
uint8_t
>
()]
=
jsonMappedIdIt
->
get
<
uint8_t
>
();
}
auto
jsonEncodingsIt
=
jsonRtpMappingIt
->
find
(
"encodings"
);
auto
jsonEncodingsIt
=
jsonRtpMappingIt
->
find
(
"encodings"
);
if
(
jsonEncodingsIt
==
jsonRtpMappingIt
->
end
()
||
!
jsonEncodingsIt
->
is_array
())
if
(
jsonEncodingsIt
==
jsonRtpMappingIt
->
end
()
||
!
jsonEncodingsIt
->
is_array
())
...
@@ -143,58 +122,46 @@ namespace RTC
...
@@ -143,58 +122,46 @@ namespace RTC
MS_THROW_TYPE_ERROR
(
"rtpParameters.encodings size does not match rtpMapping.encodings size"
);
MS_THROW_TYPE_ERROR
(
"rtpParameters.encodings size does not match rtpMapping.encodings size"
);
}
}
// Fill RTP header extension ids
and their mapped values
.
// Fill RTP header extension ids.
// This may throw.
// This may throw.
for
(
auto
&
exten
:
this
->
rtpParameters
.
headerExtensions
)
for
(
auto
&
exten
:
this
->
rtpParameters
.
headerExtensions
)
{
{
if
(
exten
.
id
==
0u
)
if
(
exten
.
id
==
0u
)
MS_THROW_TYPE_ERROR
(
"RTP extension id cannot be 0"
);
MS_THROW_TYPE_ERROR
(
"RTP extension id cannot be 0"
);
auto
it
=
this
->
rtpMapping
.
headerExtensions
.
find
(
exten
.
id
);
if
(
this
->
rtpHeaderExtensionIds
.
mid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
MID
)
{
// This should not happen since rtpMapping has been made reading the rtpParameters.
this
->
rtpHeaderExtensionIds
.
mid
=
exten
.
id
;
if
(
it
==
this
->
rtpMapping
.
headerExtensions
.
end
())
}
MS_THROW_TYPE_ERROR
(
"RTP extension id not present in the RTP mapping"
);
auto
mappedId
=
it
->
second
;
if
(
mappedId
==
0u
)
MS_THROW_TYPE_ERROR
(
"mapped RTP extension id cannot be 0"
);
if
(
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
)
if
(
this
->
rtpHeaderExtensionIds
.
rid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
)
{
{
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
rid
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
ssrcAudioLevel
=
mappedId
;
}
}
if
(
this
->
rtpHeaderExtensionIds
.
videoOrientation
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
)
if
(
this
->
rtpHeaderExtensionIds
.
rrid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
REPAIRED_RTP_STREAM_ID
)
{
{
this
->
rtpHeaderExtensionIds
.
videoOrientation
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
rrid
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
videoOrientation
=
mappedId
;
}
}
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
)
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
)
{
{
this
->
rtpHeaderExtensionIds
.
absSendTime
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
absSendTime
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
absSendTime
=
mappedId
;
}
}
if
(
this
->
rtpHeaderExtensionIds
.
mid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
MID
)
if
(
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
)
{
{
this
->
rtpHeaderExtensionIds
.
mid
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
mid
=
mappedId
;
}
}
if
(
this
->
rtpHeaderExtensionIds
.
rid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
)
if
(
this
->
rtpHeaderExtensionIds
.
videoOrientation
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
)
{
{
this
->
rtpHeaderExtensionIds
.
rid
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
videoOrientation
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
rid
=
mappedId
;
}
}
if
(
this
->
rtpHeaderExtensionIds
.
rrid
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
REPAIRED_RTP_STREAM_ID
)
if
(
this
->
rtpHeaderExtensionIds
.
toffset
==
0u
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
TOFFSET
)
{
{
this
->
rtpHeaderExtensionIds
.
rrid
=
exten
.
id
;
this
->
rtpHeaderExtensionIds
.
toffset
=
exten
.
id
;
this
->
mappedRtpHeaderExtensionIds
.
rrid
=
mappedId
;
}
}
}
}
...
@@ -271,27 +238,6 @@ namespace RTC
...
@@ -271,27 +238,6 @@ namespace RTC
}
}
}
}
// Add rtpMapping.headerExtensions.
{
(
*
jsonRtpMappingIt
)[
"headerExtensions"
]
=
json
::
array
();
auto
jsonHeaderExtensionsIt
=
jsonRtpMappingIt
->
find
(
"headerExtensions"
);
size_t
idx
{
0
};
for
(
auto
&
kv
:
this
->
rtpMapping
.
headerExtensions
)
{
jsonHeaderExtensionsIt
->
emplace_back
(
json
::
value_t
::
object
);
auto
&
jsonEntry
=
(
*
jsonHeaderExtensionsIt
)[
idx
];
auto
id
=
kv
.
first
;
auto
mappedId
=
kv
.
second
;
jsonEntry
[
"id"
]
=
id
;
jsonEntry
[
"mappedId"
]
=
mappedId
;
++
idx
;
}
}
// Add rtpMapping.encodings.
// Add rtpMapping.encodings.
{
{
(
*
jsonRtpMappingIt
)[
"encodings"
]
=
json
::
array
();
(
*
jsonRtpMappingIt
)[
"encodings"
]
=
json
::
array
();
...
@@ -862,58 +808,82 @@ namespace RTC
...
@@ -862,58 +808,82 @@ namespace RTC
// Mangle RTP header extensions.
// Mangle RTP header extensions.
{
{
static
uint8_t
buffer
[
4096
];
static
uint8_t
buffer
[
4096
];
static
std
::
vector
<
uint8_t
>
extenIds
;
static
std
::
vector
<
RTC
::
RtpPacket
::
GenericExtension
>
extensions
;
static
std
::
vector
<
RTC
::
RtpPacket
::
GenericExtension
>
extensions
;
uint8_t
*
bufferPtr
{
buffer
};
// This happens just once.
if
(
extenIds
.
capacity
()
!=
24
)
extenIds
.
reserve
(
24
);
extenIds
.
clear
();
if
(
extensions
.
capacity
()
!=
24
)
if
(
extensions
.
capacity
()
!=
24
)
extensions
.
reserve
(
24
);
extensions
.
reserve
(
24
);
extensions
.
clear
();
extensions
.
clear
();
uint8_t
*
extenValue
;
uint8_t
extenLen
;
uint8_t
*
bufferPtr
{
buffer
};
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
AUDIO
)
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
AUDIO
)
{
{
if
(
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
!=
0u
)
// Proxy urn:ietf:params:rtp-hdrext:ssrc-audio-level.
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
ssrcAudioLevel
);
{
extenValue
=
packet
->
GetExtension
(
this
->
rtpHeaderExtensionIds
.
ssrcAudioLevel
,
extenLen
);
if
(
extenValue
)
{
std
::
memcpy
(
bufferPtr
,
extenValue
,
extenLen
);
extensions
.
emplace_back
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
),
extenLen
,
bufferPtr
);
bufferPtr
+=
extenLen
;
}
}
}
}
else
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
else
if
(
this
->
kind
==
RTC
::
Media
::
Kind
::
VIDEO
)
{
{
if
(
this
->
rtpHeaderExtensionIds
.
videoOrientation
!=
0u
)
// Proxy urn:3gpp:video-orientation.
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
videoOrientation
);
{
}
extenValue
=
packet
->
GetExtension
(
this
->
rtpHeaderExtensionIds
.
videoOrientation
,
extenLen
);
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
!=
0u
)
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
absSendTime
);
if
(
this
->
rtpHeaderExtensionIds
.
mid
!=
0u
)
if
(
extenValue
)
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
mid
);
{
std
::
memcpy
(
bufferPtr
,
extenValue
,
extenLen
);
if
(
this
->
rtpHeaderExtensionIds
.
rid
!=
0u
)
extensions
.
emplace_back
(
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
rid
);
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
),
extenLen
,
bufferPtr
);
if
(
this
->
rtpHeaderExtensionIds
.
rrid
!=
0u
)
bufferPtr
+=
extenLen
;
extenIds
.
push_back
(
rtpHeaderExtensionIds
.
rrid
);
}
}
for
(
auto
extenId
:
extenIds
)
// Proxy urn:ietf:params:rtp-hdrext:toffset.
{
{
uint8_t
extenLen
;
extenValue
=
packet
->
GetExtension
(
this
->
rtpHeaderExtensionIds
.
toffset
,
extenLen
);
uint8_t
*
extenValue
=
packet
->
GetExtension
(
extenId
,
extenLen
);
if
(
extenValue
)
if
(
extenValue
)
{
{
std
::
memcpy
(
bufferPtr
,
extenValue
,
extenLen
);
std
::
memcpy
(
bufferPtr
,
extenValue
,
extenLen
);
extensions
.
emplace_back
(
extensions
.
emplace_back
(
this
->
rtpMapping
.
headerExtensions
.
at
(
extenId
),
// Use the mapped id
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
TOFFSET
),
extenLen
,
bufferPtr
);
extenLen
,
// len
bufferPtr
// value
bufferPtr
+=
extenLen
;
);
}
}
// Add http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time.
{
extenLen
=
3u
;
auto
now
=
DepLibUV
::
GetTime
();
auto
absSendTime
=
static_cast
<
uint32_t
>
(((
now
<<
18
)
+
500
)
/
1000
)
&
0x00FFFFFF
;
Utils
::
Byte
::
Set3Bytes
(
bufferPtr
,
0
,
absSendTime
);
extensions
.
emplace_back
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
),
extenLen
,
bufferPtr
);
bufferPtr
+=
extenLen
;
bufferPtr
+=
extenLen
;
}
}
...
@@ -922,13 +892,14 @@ namespace RTC
...
@@ -922,13 +892,14 @@ namespace RTC
// Set the new extensions into the packet using One-Byte format.
// Set the new extensions into the packet using One-Byte format.
packet
->
SetExtensions
(
1
,
extensions
);
packet
->
SetExtensions
(
1
,
extensions
);
// Assign mapped RTP header extension ids.
// Assign mediasoup RTP header extension ids (just those that mediasoup may
packet
->
SetAudioLevelExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
ssrcAudioLevel
);
// be interested in after passing it to the Router).
packet
->
SetVideoOrientationExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
videoOrientation
);
packet
->
SetAbsSendTimeExtensionId
(
packet
->
SetAbsSendTimeExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
absSendTime
);
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
));
packet
->
SetMidExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
mid
);
packet
->
SetSsrcAudioLevelExtensionId
(
packet
->
SetRidExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
rid
);
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
));
packet
->
SetRepairedRidExtensionId
(
this
->
mappedRtpHeaderExtensionIds
.
rrid
);
packet
->
SetVideoOrientationExtensionId
(
static_cast
<
uint8_t
>
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
));
}
}
return
true
;
return
true
;
...
...
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
浏览文件 @
2a28bb32
...
@@ -12,13 +12,13 @@ namespace RTC
...
@@ -12,13 +12,13 @@ namespace RTC
// clang-format off
// clang-format off
std
::
unordered_map
<
std
::
string
,
RtpHeaderExtensionUri
::
Type
>
RtpHeaderExtensionUri
::
string2Type
=
std
::
unordered_map
<
std
::
string
,
RtpHeaderExtensionUri
::
Type
>
RtpHeaderExtensionUri
::
string2Type
=
{
{
{
"urn:ietf:params:rtp-hdrext:ssrc-audio-level"
,
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
},
{
"urn:ietf:params:rtp-hdrext:toffset"
,
RtpHeaderExtensionUri
::
Type
::
TO_OFFSET
},
{
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
,
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
},
{
"urn:3gpp:video-orientation"
,
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
},
{
"urn:ietf:params:rtp-hdrext:sdes:mid"
,
RtpHeaderExtensionUri
::
Type
::
MID
},
{
"urn:ietf:params:rtp-hdrext:sdes:mid"
,
RtpHeaderExtensionUri
::
Type
::
MID
},
{
"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
,
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
},
{
"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"
,
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
},
{
"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
,
RtpHeaderExtensionUri
::
Type
::
REPAIRED_RTP_STREAM_ID
}
{
"urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"
,
RtpHeaderExtensionUri
::
Type
::
REPAIRED_RTP_STREAM_ID
},
{
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"
,
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
},
{
"urn:ietf:params:rtp-hdrext:ssrc-audio-level"
,
RtpHeaderExtensionUri
::
Type
::
SSRC_AUDIO_LEVEL
},
{
"urn:3gpp:video-orientation"
,
RtpHeaderExtensionUri
::
Type
::
VIDEO_ORIENTATION
},
{
"urn:ietf:params:rtp-hdrext:toffset"
,
RtpHeaderExtensionUri
::
Type
::
TOFFSET
}
};
};
// clang-format on
// clang-format on
...
...
worker/src/RTC/RtpPacket.cpp
浏览文件 @
2a28bb32
...
@@ -203,36 +203,6 @@ namespace RTC
...
@@ -203,36 +203,6 @@ namespace RTC
MS_DEBUG_DEV
(
" RFC5285 ext ids : %s"
,
extIdsStream
.
str
().
c_str
());
MS_DEBUG_DEV
(
" RFC5285 ext ids : %s"
,
extIdsStream
.
str
().
c_str
());
}
}
}
}
if
(
this
->
audioLevelExtensionId
!=
0u
)
{
uint8_t
volume
;
bool
voice
;
if
(
ReadAudioLevel
(
volume
,
voice
))
MS_DEBUG_DEV
(
" audioLevel : extId:%"
PRIu8
",volume:%"
PRIu8
",voice:%s"
,
this
->
audioLevelExtensionId
,
volume
,
voice
?
"true"
:
"false"
);
}
if
(
this
->
videoOrientationExtensionId
!=
0u
)
{
bool
camera
;
bool
flip
;
uint16_t
rotation
;
if
(
ReadVideoOrientation
(
camera
,
flip
,
rotation
))
MS_DEBUG_DEV
(
" videoOrientation : extId:%"
PRIu8
",camera:%s,flip:%s,rotation:%"
PRIu16
,
this
->
videoOrientationExtensionId
,
camera
?
"true"
:
"false"
,
flip
?
"true"
:
"false"
,
rotation
);
}
if
(
this
->
absSendTimeExtensionId
!=
0u
)
{
MS_DEBUG_DEV
(
" absSendTime : extId:%"
PRIu8
,
this
->
absSendTimeExtensionId
);
}
if
(
this
->
midExtensionId
!=
0u
)
if
(
this
->
midExtensionId
!=
0u
)
{
{
std
::
string
mid
;
std
::
string
mid
;
...
@@ -257,6 +227,36 @@ namespace RTC
...
@@ -257,6 +227,36 @@ namespace RTC
MS_DEBUG_DEV
(
MS_DEBUG_DEV
(
" rrid : extId:%"
PRIu8
",value:%s"
,
this
->
rridExtensionId
,
rid
.
c_str
());
" rrid : extId:%"
PRIu8
",value:%s"
,
this
->
rridExtensionId
,
rid
.
c_str
());
}
}
if
(
this
->
absSendTimeExtensionId
!=
0u
)
{
MS_DEBUG_DEV
(
" absSendTime : extId:%"
PRIu8
,
this
->
absSendTimeExtensionId
);
}
if
(
this
->
ssrcAudioLevelExtensionId
!=
0u
)
{
uint8_t
volume
;
bool
voice
;
if
(
ReadSsrcAudioLevel
(
volume
,
voice
))
MS_DEBUG_DEV
(
" ssrcAudioLevel : extId:%"
PRIu8
",volume:%"
PRIu8
",voice:%s"
,
this
->
ssrcAudioLevelExtensionId
,
volume
,
voice
?
"true"
:
"false"
);
}
if
(
this
->
videoOrientationExtensionId
!=
0u
)
{
bool
camera
;
bool
flip
;
uint16_t
rotation
;
if
(
ReadVideoOrientation
(
camera
,
flip
,
rotation
))
MS_DEBUG_DEV
(
" videoOrientation : extId:%"
PRIu8
",camera:%s,flip:%s,rotation:%"
PRIu16
,
this
->
videoOrientationExtensionId
,
camera
?
"true"
:
"false"
,
flip
?
"true"
:
"false"
,
rotation
);
}
MS_DEBUG_DEV
(
" csrc count : %"
PRIu8
,
this
->
header
->
csrcCount
);
MS_DEBUG_DEV
(
" csrc count : %"
PRIu8
,
this
->
header
->
csrcCount
);
MS_DEBUG_DEV
(
" marker : %s"
,
HasMarker
()
?
"true"
:
"false"
);
MS_DEBUG_DEV
(
" marker : %s"
,
HasMarker
()
?
"true"
:
"false"
);
MS_DEBUG_DEV
(
" payload type : %"
PRIu8
,
GetPayloadType
());
MS_DEBUG_DEV
(
" payload type : %"
PRIu8
,
GetPayloadType
());
...
@@ -277,12 +277,12 @@ namespace RTC
...
@@ -277,12 +277,12 @@ namespace RTC
MS_ASSERT
(
type
==
1u
||
type
==
2u
,
"type must be 1 or 2"
);
MS_ASSERT
(
type
==
1u
||
type
==
2u
,
"type must be 1 or 2"
);
// Reset extension ids.
// Reset extension ids.
this
->
audioLevelExtensionId
=
0
;
this
->
videoOrientationExtensionId
=
0
;
this
->
absSendTimeExtensionId
=
0
;
this
->
midExtensionId
=
0
;
this
->
midExtensionId
=
0
;
this
->
ridExtensionId
=
0
;
this
->
ridExtensionId
=
0
;
this
->
rridExtensionId
=
0
;
this
->
rridExtensionId
=
0
;
this
->
absSendTimeExtensionId
=
0
;
this
->
ssrcAudioLevelExtensionId
=
0
;
this
->
videoOrientationExtensionId
=
0
;
// Clear the One-Byte and Two-Bytes extension elements maps.
// Clear the One-Byte and Two-Bytes extension elements maps.
this
->
mapOneByteExtensions
.
clear
();
this
->
mapOneByteExtensions
.
clear
();
...
@@ -494,12 +494,12 @@ namespace RTC
...
@@ -494,12 +494,12 @@ namespace RTC
newHeader
,
newHeaderExtension
,
newPayload
,
this
->
payloadLength
,
this
->
payloadPadding
,
this
->
size
);
newHeader
,
newHeaderExtension
,
newPayload
,
this
->
payloadLength
,
this
->
payloadPadding
,
this
->
size
);
// Keep already set extension ids.
// Keep already set extension ids.
packet
->
audioLevelExtensionId
=
this
->
audioLevelExtensionId
;
packet
->
videoOrientationExtensionId
=
this
->
videoOrientationExtensionId
;
packet
->
absSendTimeExtensionId
=
this
->
absSendTimeExtensionId
;
packet
->
midExtensionId
=
this
->
midExtensionId
;
packet
->
midExtensionId
=
this
->
midExtensionId
;
packet
->
ridExtensionId
=
this
->
ridExtensionId
;
packet
->
ridExtensionId
=
this
->
ridExtensionId
;
packet
->
rridExtensionId
=
this
->
rridExtensionId
;
packet
->
rridExtensionId
=
this
->
rridExtensionId
;
packet
->
absSendTimeExtensionId
=
this
->
absSendTimeExtensionId
;
packet
->
ssrcAudioLevelExtensionId
=
this
->
ssrcAudioLevelExtensionId
;
packet
->
videoOrientationExtensionId
=
this
->
videoOrientationExtensionId
;
return
packet
;
return
packet
;
}
}
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
2a28bb32
...
@@ -211,9 +211,6 @@ namespace RTC
...
@@ -211,9 +211,6 @@ namespace RTC
// header extension ids of the Producer (and not their mapped values).
// header extension ids of the Producer (and not their mapped values).
auto
&
producerRtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
auto
&
producerRtpHeaderExtensionIds
=
producer
->
GetRtpHeaderExtensionIds
();
if
(
producerRtpHeaderExtensionIds
.
absSendTime
!=
0u
)
this
->
rtpHeaderExtensionIds
.
absSendTime
=
producerRtpHeaderExtensionIds
.
absSendTime
;
if
(
producerRtpHeaderExtensionIds
.
mid
!=
0u
)
if
(
producerRtpHeaderExtensionIds
.
mid
!=
0u
)
this
->
rtpHeaderExtensionIds
.
mid
=
producerRtpHeaderExtensionIds
.
mid
;
this
->
rtpHeaderExtensionIds
.
mid
=
producerRtpHeaderExtensionIds
.
mid
;
...
@@ -223,6 +220,9 @@ namespace RTC
...
@@ -223,6 +220,9 @@ namespace RTC
if
(
producerRtpHeaderExtensionIds
.
rrid
!=
0u
)
if
(
producerRtpHeaderExtensionIds
.
rrid
!=
0u
)
this
->
rtpHeaderExtensionIds
.
rrid
=
producerRtpHeaderExtensionIds
.
rrid
;
this
->
rtpHeaderExtensionIds
.
rrid
=
producerRtpHeaderExtensionIds
.
rrid
;
if
(
producerRtpHeaderExtensionIds
.
absSendTime
!=
0u
)
this
->
rtpHeaderExtensionIds
.
absSendTime
=
producerRtpHeaderExtensionIds
.
absSendTime
;
// Create status response.
// Create status response.
json
data
(
json
::
object
());
json
data
(
json
::
object
());
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
2a28bb32
...
@@ -375,9 +375,6 @@ namespace RTC
...
@@ -375,9 +375,6 @@ namespace RTC
jsonObject
[
"rtpHeaderExtensions"
]
=
json
::
object
();
jsonObject
[
"rtpHeaderExtensions"
]
=
json
::
object
();
auto
jsonRtpHeaderExtensionsIt
=
jsonObject
.
find
(
"rtpHeaderExtensions"
);
auto
jsonRtpHeaderExtensionsIt
=
jsonObject
.
find
(
"rtpHeaderExtensions"
);
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"absSendTime"
]
=
this
->
rtpHeaderExtensionIds
.
absSendTime
;
if
(
this
->
rtpHeaderExtensionIds
.
mid
!=
0u
)
if
(
this
->
rtpHeaderExtensionIds
.
mid
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"mid"
]
=
this
->
rtpHeaderExtensionIds
.
mid
;
(
*
jsonRtpHeaderExtensionsIt
)[
"mid"
]
=
this
->
rtpHeaderExtensionIds
.
mid
;
...
@@ -387,6 +384,9 @@ namespace RTC
...
@@ -387,6 +384,9 @@ namespace RTC
if
(
this
->
rtpHeaderExtensionIds
.
rrid
!=
0u
)
if
(
this
->
rtpHeaderExtensionIds
.
rrid
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"rrid"
]
=
this
->
rtpHeaderExtensionIds
.
rrid
;
(
*
jsonRtpHeaderExtensionsIt
)[
"rrid"
]
=
this
->
rtpHeaderExtensionIds
.
rrid
;
if
(
this
->
rtpHeaderExtensionIds
.
absSendTime
!=
0u
)
(
*
jsonRtpHeaderExtensionsIt
)[
"absSendTime"
]
=
this
->
rtpHeaderExtensionIds
.
absSendTime
;
// Add rtpListener.
// Add rtpListener.
this
->
rtpListener
.
FillJson
(
jsonObject
[
"rtpListener"
]);
this
->
rtpListener
.
FillJson
(
jsonObject
[
"rtpListener"
]);
}
}
...
@@ -972,10 +972,10 @@ namespace RTC
...
@@ -972,10 +972,10 @@ namespace RTC
}
}
// Apply the Transport RTP header extension ids so the RTP listener can use them.
// Apply the Transport RTP header extension ids so the RTP listener can use them.
packet
->
SetAbsSendTimeExtensionId
(
this
->
rtpHeaderExtensionIds
.
absSendTime
);
packet
->
SetMidExtensionId
(
this
->
rtpHeaderExtensionIds
.
mid
);
packet
->
SetMidExtensionId
(
this
->
rtpHeaderExtensionIds
.
mid
);
packet
->
SetRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rid
);
packet
->
SetRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rid
);
packet
->
SetRepairedRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rrid
);
packet
->
SetRepairedRidExtensionId
(
this
->
rtpHeaderExtensionIds
.
rrid
);
packet
->
SetAbsSendTimeExtensionId
(
this
->
rtpHeaderExtensionIds
.
absSendTime
);
// Feed the REMB server.
// Feed the REMB server.
if
(
this
->
rembServer
)
if
(
this
->
rembServer
)
...
...
worker/test/src/RTC/TestRtpPacket.cpp
浏览文件 @
2a28bb32
...
@@ -104,13 +104,13 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -104,13 +104,13 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
REQUIRE
(
packet
->
HasOneByteExtensions
());
REQUIRE
(
packet
->
HasOneByteExtensions
());
REQUIRE
(
packet
->
HasTwoBytesExtensions
()
==
false
);
REQUIRE
(
packet
->
HasTwoBytesExtensions
()
==
false
);
packet
->
SetAudioLevelExtensionId
(
1
);
packet
->
Set
Ssrc
AudioLevelExtensionId
(
1
);
extenValue
=
packet
->
GetExtension
(
1
,
extenLen
);
extenValue
=
packet
->
GetExtension
(
1
,
extenLen
);
REQUIRE
(
extenLen
==
1
);
REQUIRE
(
extenLen
==
1
);
REQUIRE
(
extenValue
);
REQUIRE
(
extenValue
);
REQUIRE
(
extenValue
[
0
]
==
0xd0
);
REQUIRE
(
extenValue
[
0
]
==
0xd0
);
REQUIRE
(
packet
->
ReadAudioLevel
(
volume
,
voice
)
==
true
);
REQUIRE
(
packet
->
Read
Ssrc
AudioLevel
(
volume
,
voice
)
==
true
);
REQUIRE
(
volume
==
0
b1010000
);
REQUIRE
(
volume
==
0
b1010000
);
REQUIRE
(
voice
==
true
);
REQUIRE
(
voice
==
true
);
...
@@ -147,7 +147,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
...
@@ -147,7 +147,7 @@ SCENARIO("parse RTP packets", "[parser][rtp]")
REQUIRE
(
extenLen
==
1
);
REQUIRE
(
extenLen
==
1
);
REQUIRE
(
extenValue
);
REQUIRE
(
extenValue
);
REQUIRE
(
extenValue
[
0
]
==
0xd0
);
REQUIRE
(
extenValue
[
0
]
==
0xd0
);
REQUIRE
(
clonedPacket
->
ReadAudioLevel
(
volume
,
voice
)
==
true
);
REQUIRE
(
clonedPacket
->
Read
Ssrc
AudioLevel
(
volume
,
voice
)
==
true
);
REQUIRE
(
volume
==
0
b1010000
);
REQUIRE
(
volume
==
0
b1010000
);
REQUIRE
(
voice
==
true
);
REQUIRE
(
voice
==
true
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论