Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
4b2fa031
提交
4b2fa031
authored
11月 29, 2018
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add RTP MID extension support to identify Producers.
上级
6c27019e
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
91 行增加
和
18 行删除
+91
-18
supportedRtpCapabilities.js
lib/supportedRtpCapabilities.js
+13
-1
Producer.hpp
worker/include/RTC/Producer.hpp
+1
-0
RtpDictionaries.hpp
worker/include/RTC/RtpDictionaries.hpp
+2
-1
RtpPacket.hpp
worker/include/RTC/RtpPacket.hpp
+17
-0
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-0
PlainRtpTransport.cpp
worker/src/RTC/PlainRtpTransport.cpp
+8
-5
Producer.cpp
worker/src/RTC/Producer.cpp
+12
-2
RtpHeaderExtensionUri.cpp
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
+1
-0
RtpListener.cpp
worker/src/RTC/RtpListener.cpp
+21
-1
Transport.cpp
worker/src/RTC/Transport.cpp
+3
-4
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+12
-4
没有找到文件。
lib/supportedRtpCapabilities.js
浏览文件 @
4b2fa031
...
...
@@ -275,11 +275,23 @@ const supportedRtpCapabilities =
preferredId
:
4
,
preferredEncrypt
:
false
},
{
kind
:
'audio'
,
uri
:
'urn:ietf:params:rtp-hdrext:sdes:mid'
,
preferredId
:
5
,
preferredEncrypt
:
false
},
{
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:sdes:
rtp-stream-
id'
,
uri
:
'urn:ietf:params:rtp-hdrext:sdes:
m
id'
,
preferredId
:
5
,
preferredEncrypt
:
false
},
{
kind
:
'video'
,
uri
:
'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id'
,
preferredId
:
6
,
preferredEncrypt
:
false
}
],
fecMechanisms
:
[]
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
4b2fa031
...
...
@@ -35,6 +35,7 @@ namespace RTC
{
uint8_t
ssrcAudioLevel
{
0
};
// 0 means no ssrc-audio-level id.
uint8_t
absSendTime
{
0
};
// 0 means no abs-send-time id.
uint8_t
mid
{
0
};
// 0 means no MID id.
uint8_t
rid
{
0
};
// 0 means no RID id.
};
...
...
worker/include/RTC/RtpDictionaries.hpp
浏览文件 @
4b2fa031
...
...
@@ -134,7 +134,8 @@ namespace RTC
TO_OFFSET
=
2
,
ABS_SEND_TIME
=
3
,
VIDEO_ORIENTATION
=
4
,
RTP_STREAM_ID
=
5
MID
=
5
,
RTP_STREAM_ID
=
6
};
private
:
...
...
worker/include/RTC/RtpPacket.hpp
浏览文件 @
4b2fa031
...
...
@@ -117,6 +117,7 @@ namespace RTC
uint8_t
*
GetExtension
(
RTC
::
RtpHeaderExtensionUri
::
Type
uri
,
uint8_t
*
len
)
const
;
bool
ReadAudioLevel
(
uint8_t
*
volume
,
bool
*
voice
)
const
;
bool
ReadAbsSendTime
(
uint32_t
*
time
)
const
;
bool
ReadMid
(
const
uint8_t
**
data
,
size_t
*
len
)
const
;
bool
ReadRid
(
const
uint8_t
**
data
,
size_t
*
len
)
const
;
uint8_t
*
GetPayload
()
const
;
size_t
GetPayloadLength
()
const
;
...
...
@@ -342,6 +343,22 @@ namespace RTC
return
true
;
}
inline
bool
RtpPacket
::
ReadMid
(
const
uint8_t
**
data
,
size_t
*
len
)
const
{
uint8_t
extenLen
;
uint8_t
*
extenValue
;
extenValue
=
GetExtension
(
RTC
::
RtpHeaderExtensionUri
::
Type
::
MID
,
&
extenLen
);
if
(
!
extenValue
||
extenLen
==
0
)
return
false
;
*
data
=
extenValue
;
*
len
=
static_cast
<
size_t
>
(
extenLen
);
return
true
;
}
inline
bool
RtpPacket
::
ReadRid
(
const
uint8_t
**
data
,
size_t
*
len
)
const
{
uint8_t
extenLen
;
...
...
worker/include/RTC/Transport.hpp
浏览文件 @
4b2fa031
...
...
@@ -49,6 +49,7 @@ namespace RTC
struct
HeaderExtensionIds
{
uint8_t
absSendTime
{
0
};
// 0 means no abs-send-time id.
uint8_t
mid
{
0
};
// 0 means no MID id.
uint8_t
rid
{
0
};
// 0 means no RID id.
};
...
...
worker/src/RTC/PlainRtpTransport.cpp
浏览文件 @
4b2fa031
...
...
@@ -283,16 +283,19 @@ namespace RTC
}
// Apply the Transport RTP header extension ids so the RTP listener can use them.
if
(
this
->
headerExtensionIds
.
rid
!=
0u
)
if
(
this
->
headerExtensionIds
.
absSendTime
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
,
this
->
headerExtensionIds
.
rid
);
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
,
this
->
headerExtensionIds
.
absSendTime
);
}
if
(
this
->
headerExtensionIds
.
absSendTime
!=
0u
)
if
(
this
->
headerExtensionIds
.
mid
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
MID
,
this
->
headerExtensionIds
.
mid
);
}
if
(
this
->
headerExtensionIds
.
rid
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
,
this
->
headerExtensionIds
.
absSendTime
);
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
,
this
->
headerExtensionIds
.
rid
);
}
// Get the associated Producer.
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
4b2fa031
...
...
@@ -385,6 +385,7 @@ namespace RTC
auto
&
idMapping
=
this
->
rtpMapping
.
headerExtensionIds
;
uint8_t
ssrcAudioLevelId
{
0
};
uint8_t
absSendTimeId
{
0
};
uint8_t
midId
{
0
};
uint8_t
ridId
{
0
};
for
(
auto
&
exten
:
this
->
rtpParameters
.
headerExtensions
)
...
...
@@ -412,6 +413,17 @@ namespace RTC
this
->
transportHeaderExtensionIds
.
absSendTime
=
exten
.
id
;
}
if
((
midId
==
0u
)
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
MID
)
{
if
(
idMapping
.
find
(
exten
.
id
)
!=
idMapping
.
end
())
midId
=
idMapping
[
exten
.
id
];
else
midId
=
exten
.
id
;
this
->
headerExtensionIds
.
mid
=
midId
;
this
->
transportHeaderExtensionIds
.
mid
=
exten
.
id
;
}
if
((
ridId
==
0u
)
&&
exten
.
type
==
RTC
::
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
)
{
if
(
idMapping
.
find
(
exten
.
id
)
!=
idMapping
.
end
())
...
...
@@ -452,8 +464,6 @@ namespace RTC
}
}
// TODO: Look for muxId.
// If not found, look for encodings with encodingId (RID) field.
{
const
uint8_t
*
ridPtr
;
...
...
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionUri.cpp
浏览文件 @
4b2fa031
...
...
@@ -16,6 +16,7 @@ namespace RTC
{
"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:rtp-stream-id"
,
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
}
};
// clang-format on
...
...
worker/src/RTC/RtpListener.cpp
浏览文件 @
4b2fa031
...
...
@@ -264,7 +264,27 @@ namespace RTC
}
// Otherwise lookup into the muxId table.
// TODO: Do it.
{
const
uint8_t
*
muxIdPtr
;
size_t
muxIdLen
;
if
(
packet
->
ReadMid
(
&
muxIdPtr
,
&
muxIdLen
))
{
auto
*
charMuxIdPtr
=
const_cast
<
char
*>
(
reinterpret_cast
<
const
char
*>
(
muxIdPtr
));
std
::
string
muxId
(
charMuxIdPtr
,
muxIdLen
);
auto
it
=
this
->
muxIdTable
.
find
(
muxId
);
if
(
it
!=
this
->
muxIdTable
.
end
())
{
auto
producer
=
it
->
second
;
// Fill the ssrc table.
this
->
ssrcTable
[
packet
->
GetSsrc
()]
=
producer
;
return
producer
;
}
}
}
// Otherwise lookup into the RID table.
{
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
4b2fa031
...
...
@@ -160,14 +160,13 @@ namespace RTC
// and add them to the Transport.
if
(
producer
->
GetTransportHeaderExtensionIds
().
absSendTime
!=
0u
)
{
this
->
headerExtensionIds
.
absSendTime
=
producer
->
GetTransportHeaderExtensionIds
().
absSendTime
;
}
if
(
producer
->
GetTransportHeaderExtensionIds
().
mid
!=
0u
)
this
->
headerExtensionIds
.
mid
=
producer
->
GetTransportHeaderExtensionIds
().
mid
;
if
(
producer
->
GetTransportHeaderExtensionIds
().
rid
!=
0u
)
{
this
->
headerExtensionIds
.
rid
=
producer
->
GetTransportHeaderExtensionIds
().
rid
;
}
}
void
Transport
::
HandleConsumer
(
RTC
::
Consumer
*
consumer
)
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
4b2fa031
...
...
@@ -255,6 +255,7 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringFailed
{
"failed"
};
static
const
Json
::
StaticString
JsonStringHeaderExtensionIds
{
"headerExtensionIds"
};
static
const
Json
::
StaticString
JsonStringAbsSendTime
{
"absSendTime"
};
static
const
Json
::
StaticString
JsonStringMid
{
"mid"
};
static
const
Json
::
StaticString
JsonStringRid
{
"rid"
};
static
const
Json
::
StaticString
JsonStringRtpListener
{
"rtpListener"
};
...
...
@@ -345,6 +346,9 @@ namespace RTC
if
(
this
->
headerExtensionIds
.
absSendTime
!=
0u
)
jsonHeaderExtensionIds
[
JsonStringAbsSendTime
]
=
this
->
headerExtensionIds
.
absSendTime
;
if
(
this
->
headerExtensionIds
.
mid
!=
0u
)
jsonHeaderExtensionIds
[
JsonStringMid
]
=
this
->
headerExtensionIds
.
mid
;
if
(
this
->
headerExtensionIds
.
rid
!=
0u
)
jsonHeaderExtensionIds
[
JsonStringRid
]
=
this
->
headerExtensionIds
.
rid
;
...
...
@@ -856,15 +860,19 @@ namespace RTC
}
// Apply the Transport RTP header extension ids so the RTP listener can use them.
if
(
this
->
headerExtensionIds
.
rid
!=
0u
)
if
(
this
->
headerExtensionIds
.
absSendTime
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
,
this
->
headerExtensionIds
.
rid
);
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
,
this
->
headerExtensionIds
.
absSendTime
);
}
if
(
this
->
headerExtensionIds
.
absSendTime
!=
0u
)
if
(
this
->
headerExtensionIds
.
mid
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
MID
,
this
->
headerExtensionIds
.
mid
);
}
if
(
this
->
headerExtensionIds
.
rid
!=
0u
)
{
packet
->
AddExtensionMapping
(
RtpHeaderExtensionUri
::
Type
::
ABS_SEND_TIME
,
this
->
headerExtensionIds
.
absSendTime
);
RtpHeaderExtensionUri
::
Type
::
RTP_STREAM_ID
,
this
->
headerExtensionIds
.
rid
);
}
// Feed the remote bitrate estimator (REMB).
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论