Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
ffb0a1ec
提交
ffb0a1ec
authored
6月 03, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create RtpDictionaries
上级
3eba0a0e
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
261 行增加
和
225 行删除
+261
-225
dtls-cert.pem
test/data/dtls-cert.pem
+18
-0
dtls-key.pem
test/data/dtls-key.pem
+15
-0
test_mediasoup.js
test/test_mediasoup.js
+19
-0
CustomParameters.h
worker/include/RTC/CustomParameters.h
+108
-0
RtpDictionaries.h
worker/include/RTC/RtpDictionaries.h
+8
-65
RtpReceiver.h
worker/include/RTC/RtpReceiver.h
+1
-1
RtpSender.h
worker/include/RTC/RtpSender.h
+1
-1
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+11
-10
CustomParameters.cpp
worker/src/RTC/CustomParameters.cpp
+64
-0
RtcpFeedback.cpp
worker/src/RTC/RtpDictionaries/RtcpFeedback.cpp
+1
-1
RtcpParameters.cpp
worker/src/RTC/RtpDictionaries/RtcpParameters.cpp
+1
-1
RtpCodecParameters.cpp
worker/src/RTC/RtpDictionaries/RtpCodecParameters.cpp
+5
-22
RtpEncodingParameters.cpp
worker/src/RTC/RtpDictionaries/RtpEncodingParameters.cpp
+1
-1
RtpFecParameters.cpp
worker/src/RTC/RtpDictionaries/RtpFecParameters.cpp
+1
-1
RtpHeaderExtensionParameters.cpp
.../src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp
+5
-22
RtpParameters.cpp
worker/src/RTC/RtpDictionaries/RtpParameters.cpp
+1
-58
RtpRtxParameters.cpp
worker/src/RTC/RtpDictionaries/RtpRtxParameters.cpp
+1
-1
CustomParameterValue.cpp
worker/src/RTC/RtpParameters/CustomParameterValue.cpp
+0
-41
没有找到文件。
test/data/dtls-cert.pem
0 → 100644
浏览文件 @
ffb0a1ec
-----BEGIN CERTIFICATE-----
MIIC1DCCAj2gAwIBAgIEV1FAejANBgkqhkiG9w0BAQUFADCBlDEXMBUGA1UEAwwO
bWVkaWFzb3VwLnRlc3QxCzAJBgNVBAYTAkVTMRcwFQYDVQQIDA5CYXNxdWUgQ291
bnRyeTEWMBQGA1UECgwNbWVkaWFzb3VwLm9yZzEcMBoGA1UECwwTScOxYWtpIEJh
eiBDYXN0aWxsbzEdMBsGCgmSJomT8ixkAQMMDWliY0BhbGlheC5uZXQwIBcNMTYw
NjAyMDgzMTU5WhgPMjExNjA1MTAwODMxNTlaMIGUMRcwFQYDVQQDDA5tZWRpYXNv
dXAudGVzdDELMAkGA1UEBhMCRVMxFzAVBgNVBAgMDkJhc3F1ZSBDb3VudHJ5MRYw
FAYDVQQKDA1tZWRpYXNvdXAub3JnMRwwGgYDVQQLDBNJw7Fha2kgQmF6IENhc3Rp
bGxvMR0wGwYKCZImiZPyLGQBAwwNaWJjQGFsaWF4Lm5ldDCBnzANBgkqhkiG9w0B
AQEFAAOBjQAwgYkCgYEA4CLsku8EBdmFwzlJTZIOqBn9LCyVhJ1R7FCQyb3lpDZB
eMl5N0yHn5kSqEftnnljh+C7pYFXyZi562aQyzft9kAR9Uh3CpOjlHrO86UfuPo8
rw6bBjRANrnvSL7PFLzvIMh4pFx+KFN6PIS5eP5bLXGWwXZHBZmvCl0+ba9k/WkC
AwEAAaMvMC0wDAYDVR0TBAUwAwEB/zAdBgNVHQ4EFgQUnfpsDRCSxR6BehrGZXzk
OK5qs8wwDQYJKoZIhvcNAQEFBQADgYEAeSIguI+i5tVAmu/olpQyI6gdVnU1bPYq
XfQ4tEw4typmsDTHI114mcKrbPiOva90L4QQ/0Z4oTXZO889n1UPldfdqFy+CkiI
HjsVllA+Gbhnpyka1CpkDlDaC3AP6uhr+g/ofRoA+9gevDMDUo5ypjRK9YOrq+S1
AnQIgdx/b5E=
-----END CERTIFICATE-----
test/data/dtls-key.pem
0 → 100644
浏览文件 @
ffb0a1ec
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDgIuyS7wQF2YXDOUlNkg6oGf0sLJWEnVHsUJDJveWkNkF4yXk3
TIefmRKoR+2eeWOH4LulgVfJmLnrZpDLN+32QBH1SHcKk6OUes7zpR+4+jyvDpsG
NEA2ue9Ivs8UvO8gyHikXH4oU3o8hLl4/lstcZbBdkcFma8KXT5tr2T9aQIDAQAB
AoGBAJxKXhLbTj/R/X8zPBU2Krg3Xx3lfOE7XjvdtginPTFzj9XtD3RrDgtRDvx/
I4ek961xHQf8mD2AHOyz2XWLa4dD9esA3V66mBmZZd3m/sdGltIuBcWtx1M1V9Fk
cjr/tZt/2w4QcLYGrOYXQ19i3+b+j9us0nnuyDcmNghWvyXNAkEA8LvFBoAT4pjd
yOa2rYdg/vAAPHlMNWLlk7bhrhPc42zxgQ+KIpX2bQelJgcU695oJuuNjc2JSJLh
xKOaaxuZEwJBAO5ZtOlHg+deqYiKU6ClBOo9xaHtion8rSUmdKdt7qZ6SO1lhIe5
UNqd7E9pjqxOvxUK+Jd3C2jd4Jk0AtER+xMCQQC+pwboGgEloYlsdYPRtHjWDr8x
JaN8WGGXdewP0H1MxFgTrXnp4Dh0quxZTJx+HPsBb+YAmvoRtvoEoMlH8GhvAj8i
ctSy4qMtzYCzO0ra7P7I3CS0QqDDUMG1nNk/WaQka4gex41gEGifMDP3RkpYnQkB
AZTsT0hW37qWae3+SZsCQQCCdN/mQfnDJyydEtNvUXnqygWg4oO1E2q3KCtVZFCY
OOocVEjiut4HCdzwIkEonBWUVofCDURycmtw3/PpqCvN
-----END RSA PRIVATE KEY-----
test/test_mediasoup.js
浏览文件 @
ffb0a1ec
'use strict'
;
const
path
=
require
(
'path'
);
const
tap
=
require
(
'tap'
);
const
mediasoup
=
require
(
'../'
);
...
...
@@ -34,6 +35,24 @@ tap.test('mediasoup.Server() with valid options must succeed', { timeout: 2000 }
setTimeout
(()
=>
server
.
close
(),
100
);
});
tap
.
test
(
'mediasoup.Server() with valid DTLS certificate must succeed'
,
{
timeout
:
2000
},
(
t
)
=>
{
let
server
=
mediasoup
.
Server
(
{
numWorkers
:
1
,
dtlsCertificateFile
:
path
.
join
(
__dirname
,
'data'
,
'dtls-cert.pem'
),
dtlsPrivateKeyFile
:
path
.
join
(
__dirname
,
'data'
,
'dtls-key.pem'
)
});
server
.
on
(
'close'
,
(
error
)
=>
{
t
.
error
(
error
,
'server must close cleanly'
);
t
.
end
();
});
setTimeout
(()
=>
server
.
close
(),
100
);
});
tap
.
test
(
'mediasoup.Server() with wrong options must fail'
,
{
timeout
:
2000
},
(
t
)
=>
{
let
server
=
mediasoup
.
Server
({
logLevel
:
'WRONG_VALUE'
});
...
...
worker/include/RTC/CustomParameters.h
0 → 100644
浏览文件 @
ffb0a1ec
#ifndef MS_RTC_CUSTOM_PARAMETERS_H
#define MS_RTC_CUSTOM_PARAMETERS_H
#include "common.h"
#include <string>
#include <vector>
#include <unordered_map>
#include <json/json.h>
namespace
RTC
{
class
CustomParameterValue
{
private
:
enum
class
Type
{
BOOLEAN
=
1
,
INTEGER
,
DOUBLE
,
STRING
};
public
:
CustomParameterValue
()
{};
CustomParameterValue
(
bool
booleanValue
)
:
type
(
Type
::
BOOLEAN
),
booleanValue
(
booleanValue
)
{}
CustomParameterValue
(
int32_t
integerValue
)
:
type
(
Type
::
INTEGER
),
integerValue
(
integerValue
)
{}
CustomParameterValue
(
double
doubleValue
)
:
type
(
Type
::
DOUBLE
),
doubleValue
(
doubleValue
)
{}
CustomParameterValue
(
std
::
string
&
stringValue
)
:
type
(
Type
::
STRING
),
stringValue
(
stringValue
)
{}
Json
::
Value
toJson
()
{
switch
(
this
->
type
)
{
case
Type
:
:
BOOLEAN
:
return
this
->
booleanValue
;
case
Type
:
:
INTEGER
:
return
(
Json
::
Int
)
this
->
integerValue
;
case
Type
:
:
DOUBLE
:
return
this
->
doubleValue
;
case
Type
:
:
STRING
:
return
this
->
stringValue
;
default
:
return
Json
::
nullValue
;
}
}
bool
IsBoolean
()
{
return
this
->
type
==
Type
::
BOOLEAN
;
}
bool
IsInteger
()
{
return
this
->
type
==
Type
::
INTEGER
;
}
bool
IsPositiveInteger
()
{
return
this
->
type
==
Type
::
INTEGER
&&
this
->
integerValue
>=
0
;
}
bool
IsDouble
()
{
return
this
->
type
==
Type
::
DOUBLE
;
}
bool
IsPositiveDouble
()
{
return
this
->
type
==
Type
::
DOUBLE
&&
this
->
doubleValue
>=
0
;
}
bool
IsString
()
{
return
this
->
type
==
Type
::
STRING
;
}
private
:
Type
type
;
public
:
bool
booleanValue
=
false
;
int32_t
integerValue
=
0
;
double
doubleValue
=
0
.
0
;
std
::
string
stringValue
;
};
typedef
std
::
unordered_map
<
std
::
string
,
CustomParameterValue
>
CustomParameters
;
void
FillCustomParameters
(
CustomParameters
&
parameters
,
Json
::
Value
&
data
);
}
#endif
worker/include/RTC/Rtp
Parameter
s.h
→
worker/include/RTC/Rtp
Dictionarie
s.h
浏览文件 @
ffb0a1ec
#ifndef MS_RTC_RTP_
PARAMETER
S_H
#define MS_RTC_RTP_
PARAMETER
S_H
#ifndef MS_RTC_RTP_
DICTIONARIE
S_H
#define MS_RTC_RTP_
DICTIONARIE
S_H
#include "common.h"
#include "RTC/RtpKind.h"
#include "RTC/CustomParameters.h"
#include <string>
#include <vector>
#include <unordered_map>
...
...
@@ -10,61 +11,6 @@
namespace
RTC
{
class
CustomParameterValue
{
public
:
enum
class
Type
{
BOOLEAN
=
1
,
INTEGER
,
DOUBLE
,
STRING
};
public
:
CustomParameterValue
()
{};
CustomParameterValue
(
bool
booleanValue
);
CustomParameterValue
(
int32_t
integerValue
);
CustomParameterValue
(
double
doubleValue
);
CustomParameterValue
(
std
::
string
&
stringValue
);
virtual
~
CustomParameterValue
();
Json
::
Value
toJson
();
bool
IsBoolean
()
{
return
this
->
type
==
Type
::
BOOLEAN
;
}
bool
IsInteger
()
{
return
this
->
type
==
Type
::
INTEGER
;
}
bool
IsPositiveInteger
()
{
return
this
->
type
==
Type
::
INTEGER
&&
this
->
integerValue
>=
0
;
}
bool
IsDouble
()
{
return
this
->
type
==
Type
::
DOUBLE
;
}
bool
IsPositiveDouble
()
{
return
this
->
type
==
Type
::
DOUBLE
&&
this
->
doubleValue
>=
0
;
}
bool
IsString
()
{
return
this
->
type
==
Type
::
STRING
;
}
public
:
Type
type
;
bool
booleanValue
=
false
;
int32_t
integerValue
=
0
;
double
doubleValue
=
0
.
0
;
std
::
string
stringValue
;
};
typedef
std
::
unordered_map
<
std
::
string
,
CustomParameterValue
>
CustomParameters
;
class
RtcpFeedback
{
public
:
...
...
@@ -109,7 +55,7 @@ namespace RTC
uint32_t
ptime
=
0
;
uint32_t
numChannels
=
0
;
std
::
vector
<
RtcpFeedback
>
rtcpFeedback
;
CustomParameters
parameters
;
RTC
::
CustomParameters
parameters
;
public
:
RTC
::
RtpKind
type
;
...
...
@@ -178,10 +124,10 @@ namespace RTC
Json
::
Value
toJson
();
public
:
std
::
string
uri
;
uint16_t
id
=
0
;
bool
encrypt
=
false
;
CustomParameters
parameters
;
std
::
string
uri
;
uint16_t
id
=
0
;
bool
encrypt
=
false
;
RTC
::
CustomParameters
parameters
;
};
class
RtcpParameters
...
...
@@ -201,9 +147,6 @@ namespace RTC
class
RtpParameters
{
public
:
static
void
FillCustomParameters
(
CustomParameters
&
parameters
,
Json
::
Value
&
data
);
public
:
// Constructor for receiver's parameters.
RtpParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
);
...
...
worker/include/RTC/RtpReceiver.h
浏览文件 @
ffb0a1ec
...
...
@@ -3,7 +3,7 @@
#include "common.h"
#include "RTC/RtpKind.h"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "RTC/RtpPacket.h"
#include "Channel/Request.h"
#include "Channel/Notifier.h"
...
...
worker/include/RTC/RtpSender.h
浏览文件 @
ffb0a1ec
...
...
@@ -4,7 +4,7 @@
#include "common.h"
#include "RTC/RtpKind.h"
#include "RTC/Transport.h"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "RTC/RtpPacket.h"
#include "RTC/RtcpPacket.h"
#include "Channel/Request.h"
...
...
worker/mediasoup-worker.gyp
浏览文件 @
ffb0a1ec
...
...
@@ -26,6 +26,7 @@
'src/Channel/Notifier.cpp',
'src/Channel/Request.cpp',
'src/Channel/UnixStreamSocket.cpp',
'src/RTC/CustomParameters.cpp',
'src/RTC/DtlsTransport.cpp',
'src/RTC/IceCandidate.cpp',
'src/RTC/IceServer.cpp',
...
...
@@ -43,15 +44,14 @@
'src/RTC/Transport.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/RtpParameters/CustomParameterValue.cpp',
'src/RTC/RtpParameters/RtcpFeedback.cpp',
'src/RTC/RtpParameters/RtcpParameters.cpp',
'src/RTC/RtpParameters/RtpCodecParameters.cpp',
'src/RTC/RtpParameters/RtpEncodingParameters.cpp',
'src/RTC/RtpParameters/RtpFecParameters.cpp',
'src/RTC/RtpParameters/RtpHeaderExtensionParameters.cpp',
'src/RTC/RtpParameters/RtpParameters.cpp',
'src/RTC/RtpParameters/RtpRtxParameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
'src/RTC/RtpDictionaries/RtpCodecParameters.cpp',
'src/RTC/RtpDictionaries/RtpEncodingParameters.cpp',
'src/RTC/RtpDictionaries/RtpFecParameters.cpp',
'src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp',
'src/RTC/RtpDictionaries/RtpParameters.cpp',
'src/RTC/RtpDictionaries/RtpRtxParameters.cpp',
'src/Utils/Crypto.cpp',
'src/Utils/File.cpp',
'src/Utils/IP.cpp',
...
...
@@ -76,6 +76,7 @@
'include/Channel/Notifier.h',
'include/Channel/Request.h',
'include/Channel/UnixStreamSocket.h',
'include/RTC/CustomParameters.h',
'include/RTC/DtlsTransport.h',
'include/RTC/IceCandidate.h',
'include/RTC/IceServer.h',
...
...
@@ -85,7 +86,7 @@
'include/RTC/RtpKind.h',
'include/RTC/RtpListener.h',
'include/RTC/RtpPacket.h',
'include/RTC/Rtp
Parameter
s.h',
'include/RTC/Rtp
Dictionarie
s.h',
'include/RTC/RtpReceiver.h',
'include/RTC/RtpSender.h',
'include/RTC/SrtpSession.h',
...
...
worker/src/RTC/CustomParameters.cpp
0 → 100644
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::CustomParameters"
#include "RTC/CustomParameters.h"
#include "Logger.h"
namespace
RTC
{
/* Global methods. */
void
FillCustomParameters
(
CustomParameters
&
parameters
,
Json
::
Value
&
data
)
{
MS_TRACE
();
MS_ASSERT
(
data
.
isObject
(),
"data is not a JSON object"
);
for
(
Json
::
Value
::
iterator
it
=
data
.
begin
();
it
!=
data
.
end
();
++
it
)
{
std
::
string
key
=
it
.
key
().
asString
();
Json
::
Value
value
=
(
*
it
);
switch
(
value
.
type
())
{
case
Json
:
:
booleanValue
:
{
bool
booleanValue
=
value
.
asBool
();
parameters
[
key
]
=
CustomParameterValue
(
booleanValue
);
break
;
}
case
Json
:
:
intValue
:
{
int32_t
signedIntegerValue
=
(
int32_t
)
value
.
asInt
();
parameters
[
key
]
=
CustomParameterValue
(
signedIntegerValue
);
break
;
}
case
Json
:
:
realValue
:
{
double
doubleValue
=
value
.
asDouble
();
parameters
[
key
]
=
CustomParameterValue
(
doubleValue
);
break
;
}
case
Json
:
:
stringValue
:
{
std
::
string
stringValue
=
value
.
asString
();
parameters
[
key
]
=
CustomParameterValue
(
stringValue
);
break
;
}
default
:
;
// Just ignore other value types.
}
}
}
}
worker/src/RTC/Rtp
Parameter
s/RtcpFeedback.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtcpFeedback.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtcpFeedback"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
worker/src/RTC/Rtp
Parameter
s/RtcpParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtcpParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtcpParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
worker/src/RTC/Rtp
Parameter
s/RtpCodecParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpCodecParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpCodecParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -100,7 +100,7 @@ namespace RTC
// `parameters` is optional.
if
(
data
[
k_parameters
].
isObject
())
RTC
::
RtpParameters
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
RTC
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
// Validate codec.
switch
(
this
->
subtype
)
...
...
@@ -185,26 +185,9 @@ namespace RTC
for
(
auto
&
kv
:
this
->
parameters
)
{
const
std
::
string
&
key
=
kv
.
first
;
RTC
::
CustomParameterValue
&
parameterValue
=
kv
.
second
;
switch
(
parameterValue
.
type
)
{
case
RTC
:
:
CustomParameterValue
::
Type
::
BOOLEAN
:
json_parameters
[
key
]
=
parameterValue
.
booleanValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
INTEGER
:
json_parameters
[
key
]
=
(
Json
::
Int
)
parameterValue
.
integerValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
DOUBLE
:
json_parameters
[
key
]
=
parameterValue
.
doubleValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
STRING
:
json_parameters
[
key
]
=
parameterValue
.
stringValue
;
break
;
}
auto
&
parameterValue
=
kv
.
second
;
json_parameters
[
key
]
=
parameterValue
.
toJson
();
}
json
[
k_parameters
]
=
json_parameters
;
...
...
worker/src/RTC/Rtp
Parameter
s/RtpEncodingParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpEncodingParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpEncodingParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
worker/src/RTC/Rtp
Parameter
s/RtpFecParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpFecParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpFecParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
worker/src/RTC/Rtp
Parameter
s/RtpHeaderExtensionParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpHeaderExtensionParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpHeaderExtensionParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
@@ -40,7 +40,7 @@ namespace RTC
// `parameters` is optional.
if
(
data
[
k_parameters
].
isObject
())
RTC
::
RtpParameters
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
RTC
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
}
RtpHeaderExtensionParameters
::~
RtpHeaderExtensionParameters
()
...
...
@@ -76,26 +76,9 @@ namespace RTC
for
(
auto
&
kv
:
this
->
parameters
)
{
const
std
::
string
&
key
=
kv
.
first
;
RTC
::
CustomParameterValue
&
parameterValue
=
kv
.
second
;
switch
(
parameterValue
.
type
)
{
case
RTC
:
:
CustomParameterValue
::
Type
::
BOOLEAN
:
json_parameters
[
key
]
=
parameterValue
.
booleanValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
INTEGER
:
json_parameters
[
key
]
=
(
Json
::
Int
)
parameterValue
.
integerValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
DOUBLE
:
json_parameters
[
key
]
=
parameterValue
.
doubleValue
;
break
;
case
RTC
:
:
CustomParameterValue
::
Type
::
STRING
:
json_parameters
[
key
]
=
parameterValue
.
stringValue
;
break
;
}
auto
&
parameterValue
=
kv
.
second
;
json_parameters
[
key
]
=
parameterValue
.
toJson
();
}
json
[
k_parameters
]
=
json_parameters
;
...
...
worker/src/RTC/Rtp
Parameter
s/RtpParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
#include <unordered_set>
namespace
RTC
{
/* Class methods. */
void
RtpParameters
::
FillCustomParameters
(
CustomParameters
&
parameters
,
Json
::
Value
&
data
)
{
MS_TRACE
();
MS_ASSERT
(
data
.
isObject
(),
"data is not a JSON object"
);
for
(
Json
::
Value
::
iterator
it
=
data
.
begin
();
it
!=
data
.
end
();
++
it
)
{
std
::
string
key
=
it
.
key
().
asString
();
Json
::
Value
value
=
(
*
it
);
switch
(
value
.
type
())
{
case
Json
:
:
booleanValue
:
{
bool
booleanValue
=
value
.
asBool
();
parameters
[
key
]
=
RTC
::
CustomParameterValue
(
booleanValue
);
break
;
}
case
Json
:
:
intValue
:
{
int32_t
signedIntegerValue
=
(
int32_t
)
value
.
asInt
();
parameters
[
key
]
=
RTC
::
CustomParameterValue
(
signedIntegerValue
);
break
;
}
case
Json
:
:
realValue
:
{
double
doubleValue
=
value
.
asDouble
();
parameters
[
key
]
=
RTC
::
CustomParameterValue
(
doubleValue
);
break
;
}
case
Json
:
:
stringValue
:
{
std
::
string
stringValue
=
value
.
asString
();
parameters
[
key
]
=
RTC
::
CustomParameterValue
(
stringValue
);
break
;
}
default
:
;
// Just ignore other value types.
}
}
}
/* Instance methods. */
RtpParameters
::
RtpParameters
(
RTC
::
RtpKind
kind
,
Json
::
Value
&
data
)
:
...
...
worker/src/RTC/Rtp
Parameter
s/RtpRtxParameters.cpp
→
worker/src/RTC/Rtp
Dictionarie
s/RtpRtxParameters.cpp
浏览文件 @
ffb0a1ec
#define MS_CLASS "RTC::RtpRtxParameters"
#include "RTC/Rtp
Parameter
s.h"
#include "RTC/Rtp
Dictionarie
s.h"
#include "MediaSoupError.h"
#include "Logger.h"
...
...
worker/src/RTC/RtpParameters/CustomParameterValue.cpp
deleted
100644 → 0
浏览文件 @
3eba0a0e
#define MS_CLASS "RTC::CustomParameterValue"
#include "RTC/RtpParameters.h"
#include "MediaSoupError.h"
#include "Logger.h"
namespace
RTC
{
CustomParameterValue
::
CustomParameterValue
(
bool
booleanValue
)
:
type
(
Type
::
BOOLEAN
),
booleanValue
(
booleanValue
)
{
MS_TRACE
();
}
CustomParameterValue
::
CustomParameterValue
(
int32_t
integerValue
)
:
type
(
Type
::
INTEGER
),
integerValue
(
integerValue
)
{
MS_TRACE
();
}
CustomParameterValue
::
CustomParameterValue
(
double
doubleValue
)
:
type
(
Type
::
DOUBLE
),
doubleValue
(
doubleValue
)
{
MS_TRACE
();
}
CustomParameterValue
::
CustomParameterValue
(
std
::
string
&
stringValue
)
:
type
(
Type
::
STRING
),
stringValue
(
stringValue
)
{
MS_TRACE
();
}
CustomParameterValue
::~
CustomParameterValue
()
{
MS_TRACE
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论