Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
ed83ee2c
提交
ed83ee2c
authored
2月 12, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebRTC PlanB: Allow renegotiation from clients
上级
cbf71235
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
106 行增加
和
39 行删除
+106
-39
gulpfile.js
gulpfile.js
+1
-1
Server.js
lib/Server.js
+1
-1
RTCPeerConnectionCommon.js
lib/webrtc/RTCPeerConnection/RTCPeerConnectionCommon.js
+26
-1
RTCPeerConnectionPlanB.js
lib/webrtc/RTCPeerConnection/RTCPeerConnectionPlanB.js
+0
-0
options.js
test/data/options.js
+10
-10
RtpDictionaries.h
worker/include/RTC/RtpDictionaries.h
+1
-0
DepLibUV.cpp
worker/src/DepLibUV.cpp
+2
-2
Peer.cpp
worker/src/RTC/Peer.cpp
+2
-23
RtpParameters.cpp
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
+63
-1
没有找到文件。
gulpfile.js
浏览文件 @
ed83ee2c
...
@@ -53,7 +53,7 @@ gulp.task('test:api', shell.task(
...
@@ -53,7 +53,7 @@ gulp.task('test:api', shell.task(
],
],
{
{
verbose
:
true
,
verbose
:
true
,
env
:
{
DEBUG
:
'*ABORT*'
}
env
:
{
DEBUG
:
'*ABORT*
*WARN*
'
}
}
}
));
));
...
...
lib/Server.js
浏览文件 @
ed83ee2c
...
@@ -236,7 +236,7 @@ class Server extends EventEmitter
...
@@ -236,7 +236,7 @@ class Server extends EventEmitter
this
.
emit
(
'newroom'
,
room
);
this
.
emit
(
'newroom'
,
room
);
return
room
;
return
room
;
})
})
;
}
}
_addWorker
(
worker
)
_addWorker
(
worker
)
...
...
lib/webrtc/RTCPeerConnection/RTCPeerConnectionCommon.js
浏览文件 @
ed83ee2c
...
@@ -339,7 +339,32 @@ class RTCPeerConnectionCommon extends EventEmitter
...
@@ -339,7 +339,32 @@ class RTCPeerConnectionCommon extends EventEmitter
// Re-offer received from the client.
// Re-offer received from the client.
else
else
{
{
return
this
.
_handleRemoteReOffer
(
remoteDescription
);
// Set busy flag.
this
.
_busy
=
true
;
return
this
.
_handleRemoteReOffer
(
remoteDescription
)
.
then
(()
=>
{
this
.
_logger
.
debug
(
'setRemoteDescription() | succeed'
);
// Unset busy flag.
this
.
_busy
=
false
;
// Set remote description.
this
.
_remoteDescription
=
remoteDescription
;
// Update signaling state.
this
.
_setSignalingState
(
'have-remote-offer'
);
})
.
catch
((
error
)
=>
{
this
.
_logger
.
error
(
'setRemoteDescription() | failed: %s'
,
error
);
// Unset busy flag.
this
.
_busy
=
false
;
throw
error
;
});
}
}
}
}
...
...
lib/webrtc/RTCPeerConnection/RTCPeerConnectionPlanB.js
浏览文件 @
ed83ee2c
差异被折叠。
点击展开。
test/data/options.js
浏览文件 @
ed83ee2c
...
@@ -61,7 +61,7 @@ module.exports =
...
@@ -61,7 +61,7 @@ module.exports =
{
{
kind
:
'audio'
,
kind
:
'audio'
,
name
:
'audio/opus'
,
name
:
'audio/opus'
,
payloadType
:
96
,
payloadType
:
100
,
clockRate
:
48000
,
clockRate
:
48000
,
numChannels
:
2
numChannels
:
2
},
},
...
@@ -74,23 +74,23 @@ module.exports =
...
@@ -74,23 +74,23 @@ module.exports =
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/VP8'
,
name
:
'video/VP8'
,
payloadType
:
97
,
payloadType
:
110
,
clockRate
:
90000
clockRate
:
90000
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/rtx'
,
name
:
'video/rtx'
,
payloadType
:
100
,
payloadType
:
97
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
apt
:
97
apt
:
110
}
}
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/H264'
,
name
:
'video/H264'
,
payloadType
:
98
,
payloadType
:
111
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
...
@@ -100,17 +100,17 @@ module.exports =
...
@@ -100,17 +100,17 @@ module.exports =
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/rtx'
,
name
:
'video/rtx'
,
payloadType
:
101
,
payloadType
:
98
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
apt
:
98
apt
:
111
}
}
},
},
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/H264'
,
name
:
'video/H264'
,
payloadType
:
99
,
payloadType
:
112
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
...
@@ -120,11 +120,11 @@ module.exports =
...
@@ -120,11 +120,11 @@ module.exports =
{
{
kind
:
'video'
,
kind
:
'video'
,
name
:
'video/rtx'
,
name
:
'video/rtx'
,
payloadType
:
102
,
payloadType
:
99
,
clockRate
:
90000
,
clockRate
:
90000
,
parameters
:
parameters
:
{
{
apt
:
99
apt
:
112
}
}
}
}
]
]
...
...
worker/include/RTC/RtpDictionaries.h
浏览文件 @
ed83ee2c
...
@@ -280,6 +280,7 @@ namespace RTC
...
@@ -280,6 +280,7 @@ namespace RTC
explicit
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
explicit
RtpParameters
(
const
RtpParameters
*
RtpParameters
);
Json
::
Value
toJson
();
Json
::
Value
toJson
();
void
ReduceCodecsAndEncodings
(
RtpCapabilities
&
capabilities
);
void
ReduceHeaderExtensions
(
std
::
vector
<
RtpHeaderExtension
>&
supportedHeaderExtensions
);
void
ReduceHeaderExtensions
(
std
::
vector
<
RtpHeaderExtension
>&
supportedHeaderExtensions
);
uint32_t
GetClockRateForEncoding
(
size_t
encodingIdx
);
uint32_t
GetClockRateForEncoding
(
size_t
encodingIdx
);
...
...
worker/src/DepLibUV.cpp
浏览文件 @
ed83ee2c
#define MS_CLASS "DepLibUV"
#define MS_CLASS "DepLibUV"
//
#define MS_LOG_DEV
#define MS_LOG_DEV
#include "DepLibUV.h"
#include "DepLibUV.h"
#include "Logger.h"
#include "Logger.h"
...
@@ -63,7 +63,7 @@ uint64_t DepLibUV::GetTime()
...
@@ -63,7 +63,7 @@ uint64_t DepLibUV::GetTime()
static
uint32_t
maxTimeCounter
=
32768
;
static
uint32_t
maxTimeCounter
=
32768
;
// TODO: Remove.
// TODO: Remove.
if
(
DepLibUV
::
timeUpdateCounter
==
0
)
if
(
DepLibUV
::
timeUpdateCounter
==
0
&&
LAST_NOW
!=
0
)
MS_DEBUG_DEV
(
"now - LAST_NOW: %"
PRIu64
"ms"
,
uv_now
(
DepLibUV
::
loop
)
-
LAST_NOW
);
MS_DEBUG_DEV
(
"now - LAST_NOW: %"
PRIu64
"ms"
,
uv_now
(
DepLibUV
::
loop
)
-
LAST_NOW
);
// Update the libuv's concept of “now” every N usages.
// Update the libuv's concept of “now” every N usages.
...
...
worker/src/RTC/Peer.cpp
浏览文件 @
ed83ee2c
...
@@ -684,29 +684,8 @@ namespace RTC
...
@@ -684,29 +684,8 @@ namespace RTC
auto
rtpParameters
=
rtpReceiver
->
GetParameters
();
auto
rtpParameters
=
rtpReceiver
->
GetParameters
();
// Given codecs must be a subset of the capability codecs of the peer.
// Remove unsupported codecs and their associated encodings.
for
(
auto
&
codec
:
rtpParameters
->
codecs
)
rtpParameters
->
ReduceCodecsAndEncodings
(
this
->
capabilities
);
{
auto
it
=
this
->
capabilities
.
codecs
.
begin
();
for
(;
it
!=
this
->
capabilities
.
codecs
.
end
();
++
it
)
{
auto
&
codecCapability
=
*
it
;
if
(
codecCapability
.
Matches
(
codec
,
true
))
{
// Once matched, remove the unsupported RTCP feedback from the given codec.
codec
.
ReduceRtcpFeedback
(
codecCapability
.
rtcpFeedback
);
break
;
}
}
if
(
it
==
this
->
capabilities
.
codecs
.
end
())
{
MS_THROW_ERROR
(
"no matching peer codec capability found [payloadType:%"
PRIu8
", mime:%s]"
,
codec
.
payloadType
,
codec
.
mime
.
GetName
().
c_str
());
}
}
// Remove unsupported header extensions.
// Remove unsupported header extensions.
rtpParameters
->
ReduceHeaderExtensions
(
this
->
capabilities
.
headerExtensions
);
rtpParameters
->
ReduceHeaderExtensions
(
this
->
capabilities
.
headerExtensions
);
...
...
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
浏览文件 @
ed83ee2c
...
@@ -90,7 +90,6 @@ namespace RTC
...
@@ -90,7 +90,6 @@ namespace RTC
this
->
userParameters
=
Json
::
objectValue
;
this
->
userParameters
=
Json
::
objectValue
;
// Validate RTP parameters.
// Validate RTP parameters.
ValidateCodecs
();
ValidateCodecs
();
ValidateEncodings
();
ValidateEncodings
();
}
}
...
@@ -158,6 +157,69 @@ namespace RTC
...
@@ -158,6 +157,69 @@ namespace RTC
return
json
;
return
json
;
}
}
void
RtpParameters
::
ReduceCodecsAndEncodings
(
RtpCapabilities
&
capabilities
)
{
MS_TRACE
();
std
::
vector
<
uint8_t
>
removedCodecPayloadTypes
;
for
(
auto
it
=
this
->
codecs
.
begin
();
it
!=
this
->
codecs
.
end
();)
{
auto
&
codec
=
*
it
;
auto
it2
=
capabilities
.
codecs
.
begin
();
for
(;
it2
!=
capabilities
.
codecs
.
end
();
++
it2
)
{
auto
&
codecCapability
=
*
it2
;
if
(
codecCapability
.
Matches
(
codec
,
true
))
{
// Once matched, remove the unsupported RTCP feedback from the given codec.
codec
.
ReduceRtcpFeedback
(
codecCapability
.
rtcpFeedback
);
++
it
;
break
;
}
}
if
(
it2
==
capabilities
.
codecs
.
end
())
{
MS_WARN_DEV
(
"no matching peer codec capability found [payloadType:%"
PRIu8
", mime:%s]"
,
codec
.
payloadType
,
codec
.
mime
.
GetName
().
c_str
());
removedCodecPayloadTypes
.
push_back
(
codec
.
payloadType
);
it
=
this
->
codecs
.
erase
(
it
);
}
}
// Remove encodings if associated to removed codecs.
for
(
auto
it
=
this
->
encodings
.
begin
();
it
!=
this
->
encodings
.
end
();)
{
auto
&
encoding
=
*
it
;
auto
it2
=
removedCodecPayloadTypes
.
begin
();
for
(;
it2
!=
removedCodecPayloadTypes
.
end
();
++
it2
)
{
auto
removedCodecPayloadType
=
*
it2
;
if
(
encoding
.
codecPayloadType
==
removedCodecPayloadType
)
{
MS_WARN_DEV
(
"removing encoding without matching codec"
);
it
=
this
->
encodings
.
erase
(
it
);
break
;
}
}
if
(
it2
==
removedCodecPayloadTypes
.
end
())
{
++
it
;
}
}
// Finally validate codecs and encodings.
ValidateCodecs
();
ValidateEncodings
();
}
void
RtpParameters
::
ReduceHeaderExtensions
(
std
::
vector
<
RtpHeaderExtension
>&
supportedHeaderExtensions
)
void
RtpParameters
::
ReduceHeaderExtensions
(
std
::
vector
<
RtpHeaderExtension
>&
supportedHeaderExtensions
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论