Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
5997173e
提交
5997173e
authored
11月 30, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Lot of work done in #42
上级
507f8cca
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
66 行增加
和
130 行删除
+66
-130
test_RtpReceiver.js
test/test_RtpReceiver.js
+11
-6
RtpDictionaries.h
worker/include/RTC/RtpDictionaries.h
+2
-16
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+0
-1
RTCRtpCodecRtxParameters.cpp
worker/src/RTC/RtpDictionaries/RTCRtpCodecRtxParameters.cpp
+0
-50
RtpCodecMime.cpp
worker/src/RTC/RtpDictionaries/RtpCodecMime.cpp
+2
-0
RtpCodecParameters.cpp
worker/src/RTC/RtpDictionaries/RtpCodecParameters.cpp
+16
-23
RtpParameters.cpp
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
+34
-5
RtpListener.cpp
worker/src/RTC/RtpListener.cpp
+1
-29
没有找到文件。
test/test_RtpReceiver.js
浏览文件 @
5997173e
...
@@ -146,13 +146,8 @@ tap.test('rtpReceiver.receive() with full rtpParameters must succeed', { timeout
...
@@ -146,13 +146,8 @@ tap.test('rtpReceiver.receive() with full rtpParameters must succeed', { timeout
maxptime
:
80
,
maxptime
:
80
,
ptime
:
60
,
ptime
:
60
,
numChannels
:
2
,
numChannels
:
2
,
// TODO: uncomment when RT
X and RTCP
implemented
// TODO: uncomment when RT
CP is
implemented
rtcpFeedback
:
[],
rtcpFeedback
:
[],
// rtx :
// {
// payloadType : 96,
// rtxTime : 500
// },
// rtcpFeedback :
// rtcpFeedback :
// [
// [
// { type: 'ccm', parameter: 'fir' },
// { type: 'ccm', parameter: 'fir' },
...
@@ -171,6 +166,16 @@ tap.test('rtpReceiver.receive() with full rtpParameters must succeed', { timeout
...
@@ -171,6 +166,16 @@ tap.test('rtpReceiver.receive() with full rtpParameters must succeed', { timeout
lol
:
-
456.789
,
lol
:
-
456.789
,
ids
:
[
123
,
2
,
3
]
ids
:
[
123
,
2
,
3
]
}
}
},
{
name
:
'video/rtx'
,
payloadType
:
96
,
clockRate
:
90000
,
parameters
:
{
apt
:
101
,
rtxTime
:
500
}
}
}
],
],
encodings
:
encodings
:
...
...
worker/include/RTC/RtpDictionaries.h
浏览文件 @
5997173e
...
@@ -67,7 +67,8 @@ namespace RTC
...
@@ -67,7 +67,8 @@ namespace RTC
CN
=
300
,
CN
=
300
,
TELEPHONE_EVENT
,
TELEPHONE_EVENT
,
// Feature codecs:
// Feature codecs:
ULPFEC
=
400
,
RTX
=
400
,
ULPFEC
,
FLEXFEC
,
FLEXFEC
,
RED
RED
};
};
...
@@ -121,19 +122,6 @@ namespace RTC
...
@@ -121,19 +122,6 @@ namespace RTC
std
::
string
name
;
std
::
string
name
;
};
};
class
RTCRtpCodecRtxParameters
{
public
:
RTCRtpCodecRtxParameters
()
{};
RTCRtpCodecRtxParameters
(
Json
::
Value
&
data
);
Json
::
Value
toJson
();
public
:
uint8_t
payloadType
=
0
;
uint32_t
rtxTime
=
0
;
};
class
RtcpFeedback
class
RtcpFeedback
{
{
public
:
public
:
...
@@ -171,8 +159,6 @@ namespace RTC
...
@@ -171,8 +159,6 @@ namespace RTC
uint32_t
ptime
=
0
;
uint32_t
ptime
=
0
;
uint32_t
numChannels
=
1
;
uint32_t
numChannels
=
1
;
RTC
::
Parameters
parameters
;
RTC
::
Parameters
parameters
;
RTCRtpCodecRtxParameters
rtx
;
bool
hasRtx
=
false
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
};
};
...
...
worker/mediasoup-worker.gyp
浏览文件 @
5997173e
...
@@ -45,7 +45,6 @@
...
@@ -45,7 +45,6 @@
'src/RTC/UdpSocket.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/RTCRtpCodecRtxParameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
'src/RTC/RtpDictionaries/RtpCapabilities.cpp',
'src/RTC/RtpDictionaries/RtpCapabilities.cpp',
...
...
worker/src/RTC/RtpDictionaries/RTCRtpCodecRtxParameters.cpp
deleted
100644 → 0
浏览文件 @
507f8cca
#define MS_CLASS "RTC::RTCRtpCodecRtxParameters"
#include "RTC/RtpDictionaries.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RTCRtpCodecRtxParameters
::
RTCRtpCodecRtxParameters
(
Json
::
Value
&
data
)
{
MS_TRACE
();
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_rtxTime
(
"rtxTime"
);
if
(
!
data
.
isObject
())
MS_THROW_ERROR
(
"RTCRtpCodecRtxParameters is not an object"
);
// `payloadType` is mandatory.
if
(
!
data
[
k_payloadType
].
isUInt
())
MS_THROW_ERROR
(
"missing RTCRtpCodecRtxParameters.payloadType"
);
this
->
payloadType
=
(
uint8_t
)
data
[
k_payloadType
].
asUInt
();
// `rtxTime` is optional.
if
(
data
[
k_rtxTime
].
isUInt
())
this
->
rtxTime
=
(
uint32_t
)
data
[
k_rtxTime
].
asUInt
();
}
Json
::
Value
RTCRtpCodecRtxParameters
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_payloadType
(
"payloadType"
);
static
const
Json
::
StaticString
k_rtxTime
(
"rtxTime"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `payloadType`.
json
[
k_payloadType
]
=
(
Json
::
UInt
)
this
->
payloadType
;
// Add `rtxTime`.
if
(
this
->
rtxTime
)
json
[
k_rtxTime
]
=
(
Json
::
UInt
)
this
->
rtxTime
;
return
json
;
}
}
worker/src/RTC/RtpDictionaries/RtpCodecMime.cpp
浏览文件 @
5997173e
...
@@ -35,6 +35,7 @@ namespace RTC
...
@@ -35,6 +35,7 @@ namespace RTC
{
"h264"
,
RtpCodecMime
::
Subtype
::
H264
},
{
"h264"
,
RtpCodecMime
::
Subtype
::
H264
},
{
"h265"
,
RtpCodecMime
::
Subtype
::
H265
},
{
"h265"
,
RtpCodecMime
::
Subtype
::
H265
},
// Feature codecs:
// Feature codecs:
{
"rtx"
,
RtpCodecMime
::
Subtype
::
RTX
},
{
"ulpfec"
,
RtpCodecMime
::
Subtype
::
ULPFEC
},
{
"ulpfec"
,
RtpCodecMime
::
Subtype
::
ULPFEC
},
{
"flexfec"
,
RtpCodecMime
::
Subtype
::
FLEXFEC
},
{
"flexfec"
,
RtpCodecMime
::
Subtype
::
FLEXFEC
},
{
"red"
,
RtpCodecMime
::
Subtype
::
RED
},
{
"red"
,
RtpCodecMime
::
Subtype
::
RED
},
...
@@ -56,6 +57,7 @@ namespace RTC
...
@@ -56,6 +57,7 @@ namespace RTC
{
RtpCodecMime
::
Subtype
::
H264
,
"H264"
},
{
RtpCodecMime
::
Subtype
::
H264
,
"H264"
},
{
RtpCodecMime
::
Subtype
::
H265
,
"H265"
},
{
RtpCodecMime
::
Subtype
::
H265
,
"H265"
},
// Feature codecs:
// Feature codecs:
{
RtpCodecMime
::
Subtype
::
RTX
,
"rtx"
},
{
RtpCodecMime
::
Subtype
::
ULPFEC
,
"ulpfec"
},
{
RtpCodecMime
::
Subtype
::
ULPFEC
,
"ulpfec"
},
{
RtpCodecMime
::
Subtype
::
FLEXFEC
,
"flexfec"
},
{
RtpCodecMime
::
Subtype
::
FLEXFEC
,
"flexfec"
},
{
RtpCodecMime
::
Subtype
::
RED
,
"red"
},
{
RtpCodecMime
::
Subtype
::
RED
,
"red"
},
...
...
worker/src/RTC/RtpDictionaries/RtpCodecParameters.cpp
浏览文件 @
5997173e
...
@@ -21,7 +21,6 @@ namespace RTC
...
@@ -21,7 +21,6 @@ namespace RTC
static
const
Json
::
StaticString
k_ptime
(
"ptime"
);
static
const
Json
::
StaticString
k_ptime
(
"ptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
if
(
!
data
.
isObject
())
if
(
!
data
.
isObject
())
...
@@ -85,17 +84,8 @@ namespace RTC
...
@@ -85,17 +84,8 @@ namespace RTC
if
(
data
[
k_parameters
].
isObject
())
if
(
data
[
k_parameters
].
isObject
())
this
->
parameters
.
Set
(
data
[
k_parameters
]);
this
->
parameters
.
Set
(
data
[
k_parameters
]);
// if (this->scope == RTC::Scope::RECEIVE)
if
(
// {
this
->
scope
==
RTC
::
Scope
::
PEER_CAPABILITY
||
// // `rtx` is optional.
// if (data[k_rtx].isObject())
// {
// this->rtx = RTC::RTCRtpCodecRtxParameters(data[k_rtx]);
// this->hasRtx = true;
// }
// }
if
(
this
->
scope
==
RTC
::
Scope
::
PEER_CAPABILITY
||
this
->
scope
==
RTC
::
Scope
::
RECEIVE
)
this
->
scope
==
RTC
::
Scope
::
RECEIVE
)
{
{
// `rtcpFeedback` is optional.
// `rtcpFeedback` is optional.
...
@@ -129,7 +119,6 @@ namespace RTC
...
@@ -129,7 +119,6 @@ namespace RTC
static
const
Json
::
StaticString
k_ptime
(
"ptime"
);
static
const
Json
::
StaticString
k_ptime
(
"ptime"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_numChannels
(
"numChannels"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_parameters
(
"parameters"
);
static
const
Json
::
StaticString
k_rtx
(
"rtx"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
static
const
Json
::
StaticString
k_rtcpFeedback
(
"rtcpFeedback"
);
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
...
@@ -168,14 +157,8 @@ namespace RTC
...
@@ -168,14 +157,8 @@ namespace RTC
// Add `parameters`.
// Add `parameters`.
json
[
k_parameters
]
=
this
->
parameters
.
toJson
();
json
[
k_parameters
]
=
this
->
parameters
.
toJson
();
if
(
this
->
scope
==
RTC
::
Scope
::
RECEIVE
)
if
(
{
this
->
scope
==
RTC
::
Scope
::
PEER_CAPABILITY
||
// Add `rtx`
if
(
this
->
hasRtx
)
json
[
k_rtx
]
=
this
->
rtx
.
toJson
();
}
if
(
this
->
scope
==
RTC
::
Scope
::
PEER_CAPABILITY
||
this
->
scope
==
RTC
::
Scope
::
RECEIVE
)
this
->
scope
==
RTC
::
Scope
::
RECEIVE
)
{
{
// Add `rtcpFeedback`.
// Add `rtcpFeedback`.
...
@@ -206,7 +189,6 @@ namespace RTC
...
@@ -206,7 +189,6 @@ namespace RTC
return
false
;
return
false
;
}
}
// Clock rate must match.
// Clock rate must match.
if
(
this
->
clockRate
!=
codec
.
clockRate
)
if
(
this
->
clockRate
!=
codec
.
clockRate
)
return
false
;
return
false
;
...
@@ -232,7 +214,8 @@ namespace RTC
...
@@ -232,7 +214,8 @@ namespace RTC
{
{
case
RTC
:
:
RtpCodecMime
::
Subtype
::
H264
:
case
RTC
:
:
RtpCodecMime
::
Subtype
::
H264
:
{
{
if
(
this
->
parameters
.
GetInteger
(
k_packetizationMode
)
!=
if
(
this
->
parameters
.
GetInteger
(
k_packetizationMode
)
!=
codec
.
parameters
.
GetInteger
(
k_packetizationMode
))
codec
.
parameters
.
GetInteger
(
k_packetizationMode
))
{
{
return
false
;
return
false
;
...
@@ -253,12 +236,22 @@ namespace RTC
...
@@ -253,12 +236,22 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
std
::
string
k_apt
=
"apt"
;
static
std
::
string
k_packetizationMode
=
"packetizationMode"
;
static
std
::
string
k_packetizationMode
=
"packetizationMode"
;
// Check per MIME parameters and set default values.
// Check per MIME parameters and set default values.
switch
(
this
->
mime
.
subtype
)
switch
(
this
->
mime
.
subtype
)
{
{
// A RTX codec must have 'apt' parameter.
case
RTC
:
:
RtpCodecMime
::
Subtype
::
RTX
:
{
if
(
!
this
->
parameters
.
HasInteger
(
k_apt
))
MS_THROW_ERROR
(
"missing apt parameter in RTX RtpCodecParameters"
);
break
;
}
case
RTC
:
:
RtpCodecMime
::
Subtype
::
OPUS
:
case
RTC
:
:
RtpCodecMime
::
Subtype
::
OPUS
:
{
{
// Opus default numChannels is 2.
// Opus default numChannels is 2.
...
...
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
浏览文件 @
5997173e
...
@@ -163,6 +163,8 @@ namespace RTC
...
@@ -163,6 +163,8 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
std
::
string
k_apt
=
"apt"
;
// Must be at least one codec.
// Must be at least one codec.
if
(
this
->
codecs
.
size
()
==
0
)
if
(
this
->
codecs
.
size
()
==
0
)
MS_THROW_ERROR
(
"empty RtpParameters.codecs"
);
MS_THROW_ERROR
(
"empty RtpParameters.codecs"
);
...
@@ -177,14 +179,41 @@ namespace RTC
...
@@ -177,14 +179,41 @@ namespace RTC
MS_THROW_ERROR
(
"duplicated codec.payloadType"
);
MS_THROW_ERROR
(
"duplicated codec.payloadType"
);
else
else
payloadTypes
.
insert
(
codec
.
payloadType
);
payloadTypes
.
insert
(
codec
.
payloadType
);
}
for
(
auto
&
codec
:
this
->
codecs
)
switch
(
codec
.
mime
.
subtype
)
{
// A RTX codec must have 'apt' parameter pointing to a non RTX codec.
case
RTC
:
:
RtpCodecMime
::
Subtype
::
RTX
:
{
// NOTE: RtpCodecParameters already asserted that there is 'apt' parameter.
int32_t
apt
=
codec
.
parameters
.
GetInteger
(
k_apt
);
auto
it
=
this
->
codecs
.
begin
();
for
(;
it
!=
this
->
codecs
.
end
();
++
it
)
{
auto
codec
=
*
it
;
if
((
int32_t
)
codec
.
payloadType
==
apt
)
{
{
if
(
codec
.
hasRtx
&&
payloadTypes
.
find
(
codec
.
rtx
.
payloadType
)
!=
payloadTypes
.
end
())
if
(
codec
.
mime
.
subtype
==
RTC
::
RtpCodecMime
::
Subtype
::
RTX
)
MS_THROW_ERROR
(
"duplicated codec.rtx.payloadType"
);
MS_THROW_ERROR
(
"apt in RTX codec points to a RTX codec"
);
else
if
(
codec
.
mime
.
subtype
==
RTC
::
RtpCodecMime
::
Subtype
::
ULPFEC
)
MS_THROW_ERROR
(
"apt in RTX codec points to a ULPFEC codec"
);
else
if
(
codec
.
mime
.
subtype
==
RTC
::
RtpCodecMime
::
Subtype
::
FLEXFEC
)
MS_THROW_ERROR
(
"apt in RTX codec points to a FLEXFEC codec"
);
else
else
payloadTypes
.
insert
(
codec
.
rtx
.
payloadType
);
break
;
}
if
(
it
==
this
->
codecs
.
end
())
MS_THROW_ERROR
(
"apt in RTX codec points to a non existing codec"
);
}
break
;
}
default
:
;
}
}
}
}
}
...
...
worker/src/RTC/RtpListener.cpp
浏览文件 @
5997173e
...
@@ -225,27 +225,6 @@ namespace RTC
...
@@ -225,27 +225,6 @@ namespace RTC
MS_THROW_ERROR
(
"payloadType already exists in RTP listener [payloadType:%"
PRIu8
"]"
,
payloadType
);
MS_THROW_ERROR
(
"payloadType already exists in RTP listener [payloadType:%"
PRIu8
"]"
,
payloadType
);
}
}
}
}
// Also for RTX payloads.
for
(
auto
&
codec
:
rtpParameters
->
codecs
)
{
if
(
!
codec
.
hasRtx
)
continue
;
uint8_t
payloadType
=
codec
.
rtx
.
payloadType
;
if
(
!
this
->
HasPayloadType
(
payloadType
,
rtpReceiver
))
{
this
->
ptTable
[
payloadType
]
=
rtpReceiver
;
}
else
{
RemoveRtpReceiver
(
rtpReceiver
);
RollbackRtpReceiver
(
rtpReceiver
,
previousSsrcs
,
previousMuxId
,
previousPayloadTypes
);
MS_THROW_ERROR
(
"RTX payloadType already exists in RTP listener [payloadType:%"
PRIu8
"]"
,
payloadType
);
}
}
}
}
}
}
}
}
...
@@ -298,17 +277,10 @@ namespace RTC
...
@@ -298,17 +277,10 @@ namespace RTC
// Ensure the RTP PT is present in RtpParameters.
// Ensure the RTP PT is present in RtpParameters.
for
(
auto
&
codec
:
rtpParameters
->
codecs
)
for
(
auto
&
codec
:
rtpParameters
->
codecs
)
{
{
// Check
codec
s.
// Check
payload
s.
if
(
codec
.
payloadType
==
packet
->
GetPayloadType
())
if
(
codec
.
payloadType
==
packet
->
GetPayloadType
())
{
return
rtpReceiver
;
return
rtpReceiver
;
}
}
// Also check RTX payloads.
else
if
(
codec
.
hasRtx
&&
codec
.
rtx
.
payloadType
==
packet
->
GetPayloadType
())
{
return
rtpReceiver
;
}
}
// RTP PT not present.
// RTP PT not present.
// TODO: We don't want to log every warning.
// TODO: We don't want to log every warning.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论