Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
74e30699
提交
74e30699
authored
6月 16, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Work in codec capabilities
上级
8d05d4c9
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
429 行增加
和
277 行删除
+429
-277
test_Room.js
test/test_Room.js
+3
-3
CustomParameters.h
worker/include/RTC/CustomParameters.h
+0
-137
Parameters.h
worker/include/RTC/Parameters.h
+182
-0
RtpDictionaries.h
worker/include/RTC/RtpDictionaries.h
+12
-11
Utils.h
worker/include/Utils.h
+0
-1
common.h
worker/include/common.h
+1
-0
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+2
-2
CustomParameters.cpp
worker/src/RTC/CustomParameters.cpp
+0
-85
Room.cpp
worker/src/RTC/Room.cpp
+2
-3
Parameters.cpp
worker/src/RTC/RtpDictionaries/Parameters.cpp
+193
-0
RtpCodec.cpp
worker/src/RTC/RtpDictionaries/RtpCodec.cpp
+3
-1
RtpCodecCapability.cpp
worker/src/RTC/RtpDictionaries/RtpCodecCapability.cpp
+28
-11
RtpCodecParameters.cpp
worker/src/RTC/RtpDictionaries/RtpCodecParameters.cpp
+1
-11
RtpHeaderExtensionParameters.cpp
.../src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp
+2
-12
没有找到文件。
test/test_Room.js
浏览文件 @
74e30699
...
...
@@ -140,9 +140,9 @@ tap.test('room.getCapabilities() must retrieve current room capabilities', { tim
.
then
((
room
)
=>
{
// TODO: REMOVE
//
console.log(JSON.stringify(room.getCapabilities('audio'), null, '\t'));
//
console.log(JSON.stringify(room.getCapabilities('video'), null, '\t'));
//
console.log(JSON.stringify(room.getCapabilities('depth'), null, '\t'));
console
.
log
(
JSON
.
stringify
(
room
.
getCapabilities
(
'audio'
),
null
,
'
\
t'
));
console
.
log
(
JSON
.
stringify
(
room
.
getCapabilities
(
'video'
),
null
,
'
\
t'
));
console
.
log
(
JSON
.
stringify
(
room
.
getCapabilities
(
'depth'
),
null
,
'
\
t'
));
t
.
ok
(
room
.
getCapabilities
(
'audio'
),
'room.getCapabilities("audio") returns an object'
);
t
.
ok
(
room
.
getCapabilities
(
'video'
),
'room.getCapabilities("video") returns an object'
);
...
...
worker/include/RTC/CustomParameters.h
deleted
100644 → 0
浏览文件 @
8d05d4c9
#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
,
ARRAY_POSITIVE_INTEGER
};
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
)
{}
CustomParameterValue
(
std
::
vector
<
uint32_t
>&
arrayPositiveInteger
)
:
type
(
Type
::
ARRAY_POSITIVE_INTEGER
),
arrayPositiveInteger
(
arrayPositiveInteger
)
{}
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
;
}
case
Type
:
:
ARRAY_POSITIVE_INTEGER
:
{
Json
::
Value
array
(
Json
::
arrayValue
);
for
(
auto
&
entry
:
this
->
arrayPositiveInteger
)
array
.
append
((
Json
::
UInt
)
entry
);
return
array
;
}
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
;
}
bool
IsArrayPositiveInteger
()
{
return
this
->
type
==
Type
::
ARRAY_POSITIVE_INTEGER
;
}
private
:
Type
type
;
public
:
bool
booleanValue
=
false
;
int32_t
integerValue
=
0
;
double
doubleValue
=
0
.
0
;
std
::
string
stringValue
;
std
::
vector
<
uint32_t
>
arrayPositiveInteger
;
};
typedef
std
::
unordered_map
<
std
::
string
,
CustomParameterValue
>
CustomParameters
;
void
FillCustomParameters
(
CustomParameters
&
parameters
,
Json
::
Value
&
data
);
}
#endif
worker/include/RTC/Parameters.h
0 → 100644
浏览文件 @
74e30699
#ifndef MS_RTC_PARAMETERS_H
#define MS_RTC_PARAMETERS_H
#include "common.h"
#include <string>
#include <vector>
#include <unordered_map>
#include <json/json.h>
namespace
RTC
{
class
Parameters
{
public
:
class
Value
{
public
:
enum
class
Type
{
BOOLEAN
=
1
,
INTEGER
,
DOUBLE
,
STRING
,
ARRAY_OF_INTEGERS
};
public
:
Value
()
{};
Value
(
bool
booleanValue
)
:
type
(
Type
::
BOOLEAN
),
booleanValue
(
booleanValue
)
{}
Value
(
int32_t
integerValue
)
:
type
(
Type
::
INTEGER
),
integerValue
(
integerValue
)
{}
Value
(
double
doubleValue
)
:
type
(
Type
::
DOUBLE
),
doubleValue
(
doubleValue
)
{}
Value
(
std
::
string
&
stringValue
)
:
type
(
Type
::
STRING
),
stringValue
(
stringValue
)
{}
Value
(
std
::
vector
<
int32_t
>&
arrayOfIntegers
)
:
type
(
Type
::
ARRAY_OF_INTEGERS
),
arrayOfIntegers
(
arrayOfIntegers
)
{}
public
:
Type
type
;
bool
booleanValue
=
false
;
int32_t
integerValue
=
0
;
double
doubleValue
=
0
.
0
;
std
::
string
stringValue
;
std
::
vector
<
int32_t
>
arrayOfIntegers
;
};
public
:
Parameters
()
{};
Json
::
Value
toJson
();
void
Set
(
Json
::
Value
&
data
);
bool
HasBoolean
(
std
::
string
&
key
);
bool
HasInteger
(
std
::
string
&
key
);
bool
HasDouble
(
std
::
string
&
key
);
bool
HasString
(
std
::
string
&
key
);
bool
HasArrayOfIntegers
(
std
::
string
&
key
);
bool
IncludesInteger
(
std
::
string
&
key
,
int32_t
integer
);
bool
GetBoolean
(
std
::
string
&
key
);
int32_t
GetInteger
(
std
::
string
&
key
);
double
GetDouble
(
std
::
string
&
key
);
std
::
string
&
GetString
(
std
::
string
&
key
);
std
::
vector
<
int32_t
>&
GetArrayOfIntegers
(
std
::
string
&
key
);
void
SetBoolean
(
std
::
string
&
key
,
bool
booleanValue
);
void
SetInteger
(
std
::
string
&
key
,
int32_t
integerValue
);
void
SetDouble
(
std
::
string
&
key
,
double
doubleValue
);
void
SetString
(
std
::
string
&
key
,
std
::
string
&
stringValue
);
void
SetArrayOfIntegers
(
std
::
string
&
key
,
std
::
vector
<
int32_t
>&
arrayOfIntegers
);
private
:
std
::
unordered_map
<
std
::
string
,
Value
>
mapKeyValues
;
};
/* Inline methods. */
inline
bool
Parameters
::
HasBoolean
(
std
::
string
&
key
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
return
this
->
mapKeyValues
[
key
].
type
==
Value
::
Type
::
BOOLEAN
;
}
inline
bool
Parameters
::
HasInteger
(
std
::
string
&
key
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
return
this
->
mapKeyValues
[
key
].
type
==
Value
::
Type
::
INTEGER
;
}
inline
bool
Parameters
::
HasDouble
(
std
::
string
&
key
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
return
this
->
mapKeyValues
[
key
].
type
==
Value
::
Type
::
DOUBLE
;
}
inline
bool
Parameters
::
HasString
(
std
::
string
&
key
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
return
this
->
mapKeyValues
[
key
].
type
==
Value
::
Type
::
STRING
;
}
inline
bool
Parameters
::
HasArrayOfIntegers
(
std
::
string
&
key
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
return
this
->
mapKeyValues
[
key
].
type
==
Value
::
Type
::
ARRAY_OF_INTEGERS
;
}
inline
bool
Parameters
::
IncludesInteger
(
std
::
string
&
key
,
int32_t
integer
)
{
if
(
this
->
mapKeyValues
.
find
(
key
)
==
this
->
mapKeyValues
.
end
())
return
false
;
auto
&
array
=
this
->
mapKeyValues
[
key
].
arrayOfIntegers
;
return
std
::
find
(
array
.
begin
(),
array
.
end
(),
integer
)
!=
array
.
end
();
}
inline
void
Parameters
::
SetBoolean
(
std
::
string
&
key
,
bool
booleanValue
)
{
this
->
mapKeyValues
[
key
]
=
Value
(
booleanValue
);
}
inline
void
Parameters
::
SetInteger
(
std
::
string
&
key
,
int32_t
integerValue
)
{
this
->
mapKeyValues
[
key
]
=
Value
(
integerValue
);
}
inline
void
Parameters
::
SetDouble
(
std
::
string
&
key
,
double
doubleValue
)
{
this
->
mapKeyValues
[
key
]
=
Value
(
doubleValue
);
}
inline
void
Parameters
::
SetString
(
std
::
string
&
key
,
std
::
string
&
stringValue
)
{
this
->
mapKeyValues
[
key
]
=
Value
(
stringValue
);
}
inline
void
Parameters
::
SetArrayOfIntegers
(
std
::
string
&
key
,
std
::
vector
<
int32_t
>&
arrayOfIntegers
)
{
this
->
mapKeyValues
[
key
]
=
Value
(
arrayOfIntegers
);
}
}
#endif
worker/include/RTC/RtpDictionaries.h
浏览文件 @
74e30699
...
...
@@ -2,7 +2,7 @@
#define MS_RTC_RTP_DICTIONARIES_H
#include "common.h"
#include "RTC/
Custom
Parameters.h"
#include "RTC/Parameters.h"
#include <string>
#include <vector>
#include <unordered_map>
...
...
@@ -115,12 +115,12 @@ namespace RTC
RtpCodec
(
Json
::
Value
&
data
);
public
:
RtpCodecMime
mime
;
uint32_t
clockRate
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
ptime
=
0
;
uint32_t
numChannels
=
1
;
RTC
::
Custom
Parameters
parameters
;
RtpCodecMime
mime
;
uint32_t
clockRate
=
0
;
uint32_t
maxptime
=
0
;
uint32_t
ptime
=
0
;
uint32_t
numChannels
=
1
;
RTC
::
Parameters
parameters
;
};
class
RTCRtpCodecRtxParameters
...
...
@@ -220,10 +220,10 @@ namespace RTC
Json
::
Value
toJson
();
public
:
std
::
string
uri
;
uint16_t
id
=
0
;
bool
encrypt
=
false
;
RTC
::
Custom
Parameters
parameters
;
std
::
string
uri
;
uint16_t
id
=
0
;
bool
encrypt
=
false
;
RTC
::
Parameters
parameters
;
};
class
RtcpParameters
...
...
@@ -271,6 +271,7 @@ namespace RTC
Json
::
Value
toJson
();
bool
MatchesCodec
(
RtpCodec
&
codec
);
void
Reduce
(
RtpCodec
&
codec
);
public
:
Media
::
Kind
kind
=
Media
::
Kind
::
ALL
;
...
...
worker/include/Utils.h
浏览文件 @
74e30699
...
...
@@ -3,7 +3,6 @@
#include "common.h"
#include <string>
#include <algorithm> // std::transform()
#include <cstring> // std::memcmp(), std::memcpy()
#include <openssl/hmac.h>
...
...
worker/include/common.h
浏览文件 @
74e30699
...
...
@@ -2,6 +2,7 @@
#define MS_COMMON_H
#include <memory> // std::addressof()
#include <algorithm> // std::transform(), std::find()
#include <cstddef> // size_t
#include <cstdint> // uint8_t, etc
#include <cinttypes> // PRIu64, etc
...
...
worker/mediasoup-worker.gyp
浏览文件 @
74e30699
...
...
@@ -26,7 +26,6 @@
'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',
...
...
@@ -45,6 +44,7 @@
'src/RTC/TransportTuple.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/RTCRtpCodecRtxParameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpParameters.cpp',
...
...
@@ -84,10 +84,10 @@
'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',
'include/RTC/Parameters.h',
'include/RTC/Peer.h',
'include/RTC/Room.h',
'include/RTC/RtcpPacket.h',
...
...
worker/src/RTC/CustomParameters.cpp
deleted
100644 → 0
浏览文件 @
8d05d4c9
#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
;
}
case
Json
:
:
arrayValue
:
{
std
::
vector
<
uint32_t
>
arrayPositiveInteger
;
bool
isValid
=
true
;
for
(
Json
::
UInt
i
=
0
;
i
<
value
.
size
()
&&
isValid
;
i
++
)
{
auto
&
entry
=
value
[
i
];
if
(
entry
.
isUInt
())
arrayPositiveInteger
.
push_back
((
uint32_t
)
entry
.
asUInt
());
else
isValid
=
false
;
}
if
(
isValid
)
parameters
[
key
]
=
CustomParameterValue
(
arrayPositiveInteger
);
break
;
}
default
:
;
// Just ignore other value types.
}
}
}
}
worker/src/RTC/Room.cpp
浏览文件 @
74e30699
...
...
@@ -411,9 +411,8 @@ namespace RTC
if
(
it
==
Room
::
supportedRtpCapabilities
.
codecs
.
end
())
MS_THROW_ERROR
(
"no matching codec capability found"
);
// TODO: Reduce the capabilities of the found (and copied) codec (for
// example set the H264 packetizationMode parameter to a single value).
// NOTE: Maybe a RtpCodecCapability.Reduce(codec) method.
// Reduce the capabilities of the matching capability codec.
codecCapability
.
Reduce
(
roomMediaCodec
);
// Set unique PT.
...
...
worker/src/RTC/RtpDictionaries/Parameters.cpp
0 → 100644
浏览文件 @
74e30699
#define MS_CLASS "RTC::Parameters"
#include "RTC/Parameters.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
Json
::
Value
Parameters
::
toJson
()
{
MS_TRACE
();
Json
::
Value
json
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
mapKeyValues
)
{
auto
&
key
=
kv
.
first
;
auto
&
value
=
kv
.
second
;
switch
(
value
.
type
)
{
case
Value
:
:
Type
::
BOOLEAN
:
{
json
[
key
]
=
value
.
booleanValue
;
break
;
}
case
Value
:
:
Type
::
INTEGER
:
{
json
[
key
]
=
(
Json
::
Int
)
value
.
integerValue
;
break
;
}
case
Value
:
:
Type
::
DOUBLE
:
{
json
[
key
]
=
value
.
doubleValue
;
break
;
}
case
Value
:
:
Type
::
STRING
:
{
json
[
key
]
=
value
.
stringValue
;
break
;
}
case
Value
:
:
Type
::
ARRAY_OF_INTEGERS
:
{
Json
::
Value
array
(
Json
::
arrayValue
);
for
(
auto
&
entry
:
value
.
arrayOfIntegers
)
array
.
append
((
Json
::
Int
)
entry
);
json
[
key
]
=
array
;
break
;
}
}
}
return
json
;
}
void
Parameters
::
Set
(
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
();
this
->
mapKeyValues
[
key
]
=
Value
(
booleanValue
);
break
;
}
case
Json
:
:
intValue
:
{
int32_t
integerValue
=
(
int32_t
)
value
.
asInt
();
this
->
mapKeyValues
[
key
]
=
Value
(
integerValue
);
break
;
}
case
Json
:
:
realValue
:
{
double
doubleValue
=
value
.
asDouble
();
this
->
mapKeyValues
[
key
]
=
Value
(
doubleValue
);
break
;
}
case
Json
:
:
stringValue
:
{
std
::
string
stringValue
=
value
.
asString
();
this
->
mapKeyValues
[
key
]
=
Value
(
stringValue
);
break
;
}
case
Json
:
:
arrayValue
:
{
std
::
vector
<
int32_t
>
arrayOfIntegers
;
bool
isValid
=
true
;
for
(
Json
::
UInt
i
=
0
;
i
<
value
.
size
()
&&
isValid
;
i
++
)
{
auto
&
entry
=
value
[
i
];
if
(
entry
.
isInt
())
arrayOfIntegers
.
push_back
((
int32_t
)
entry
.
asInt
());
else
isValid
=
false
;
}
if
(
isValid
)
this
->
mapKeyValues
[
key
]
=
Value
(
arrayOfIntegers
);
break
;
}
default
:
;
// Just ignore other value types.
}
}
}
bool
Parameters
::
GetBoolean
(
std
::
string
&
key
)
{
MS_TRACE
();
MS_ASSERT
(
this
->
mapKeyValues
.
find
(
key
)
!=
this
->
mapKeyValues
.
end
(),
"key does not exist [key:%s]"
,
key
.
c_str
());
return
this
->
mapKeyValues
[
key
].
booleanValue
;
}
int32_t
Parameters
::
GetInteger
(
std
::
string
&
key
)
{
MS_TRACE
();
MS_ASSERT
(
this
->
mapKeyValues
.
find
(
key
)
!=
this
->
mapKeyValues
.
end
(),
"key does not exist [key:%s]"
,
key
.
c_str
());
return
this
->
mapKeyValues
[
key
].
integerValue
;
}
double
Parameters
::
GetDouble
(
std
::
string
&
key
)
{
MS_TRACE
();
MS_ASSERT
(
this
->
mapKeyValues
.
find
(
key
)
!=
this
->
mapKeyValues
.
end
(),
"key does not exist [key:%s]"
,
key
.
c_str
());
return
this
->
mapKeyValues
[
key
].
doubleValue
;
}
std
::
string
&
Parameters
::
GetString
(
std
::
string
&
key
)
{
MS_TRACE
();
MS_ASSERT
(
this
->
mapKeyValues
.
find
(
key
)
!=
this
->
mapKeyValues
.
end
(),
"key does not exist [key:%s]"
,
key
.
c_str
());
return
this
->
mapKeyValues
[
key
].
stringValue
;
}
std
::
vector
<
int32_t
>&
Parameters
::
GetArrayOfIntegers
(
std
::
string
&
key
)
{
MS_TRACE
();
MS_ASSERT
(
this
->
mapKeyValues
.
find
(
key
)
!=
this
->
mapKeyValues
.
end
(),
"key does not exist [key:%s]"
,
key
.
c_str
());
return
this
->
mapKeyValues
[
key
].
arrayOfIntegers
;
}
}
worker/src/RTC/RtpDictionaries/RtpCodec.cpp
浏览文件 @
74e30699
...
...
@@ -52,6 +52,8 @@ namespace RTC
// `parameters` is optional.
if
(
data
[
k_parameters
].
isObject
())
RTC
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
this
->
parameters
.
Set
(
data
[
k_parameters
]);
// TODO: Check per MIME parameters and set default values.
}
}
worker/src/RTC/RtpDictionaries/RtpCodecCapability.cpp
浏览文件 @
74e30699
...
...
@@ -64,6 +64,8 @@ namespace RTC
// `svcMultiStreamSupport` is optional.
if
(
data
[
k_svcMultiStreamSupport
].
isBool
())
this
->
svcMultiStreamSupport
=
data
[
k_svcMultiStreamSupport
].
asBool
();
// TODO: Check per MIME parameters and set default values.
}
Json
::
Value
RtpCodecCapability
::
toJson
()
...
...
@@ -118,17 +120,7 @@ namespace RTC
}
// Add `parameters`.
Json
::
Value
json_parameters
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
parameters
)
{
const
std
::
string
&
key
=
kv
.
first
;
auto
&
parameterValue
=
kv
.
second
;
json_parameters
[
key
]
=
parameterValue
.
toJson
();
}
json
[
k_parameters
]
=
json_parameters
;
json
[
k_parameters
]
=
this
->
parameters
.
toJson
();
// Add `maxTemporalLayers` (if set).
if
(
this
->
maxTemporalLayers
)
...
...
@@ -184,4 +176,29 @@ namespace RTC
return
true
;
}
// NOTE: This method assumes that MatchesCodec() has been called before
// with same codec and returned true.
void
RtpCodecCapability
::
Reduce
(
RtpCodec
&
codec
)
{
MS_TRACE
();
static
std
::
string
k_packetizationMode
=
"packetizationMode"
;
switch
(
codec
.
mime
.
subtype
)
{
case
RTC
:
:
RtpCodecMime
::
Subtype
::
H264
:
{
std
::
vector
<
int32_t
>
packetizationMode
;
packetizationMode
.
push_back
(
codec
.
parameters
.
GetInteger
(
k_packetizationMode
));
this
->
parameters
.
SetArrayOfIntegers
(
k_packetizationMode
,
packetizationMode
);
break
;
}
default
:
;
}
}
}
worker/src/RTC/RtpDictionaries/RtpCodecParameters.cpp
浏览文件 @
74e30699
...
...
@@ -96,17 +96,7 @@ namespace RTC
}
// Add `parameters`.
Json
::
Value
json_parameters
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
parameters
)
{
const
std
::
string
&
key
=
kv
.
first
;
auto
&
parameterValue
=
kv
.
second
;
json_parameters
[
key
]
=
parameterValue
.
toJson
();
}
json
[
k_parameters
]
=
json_parameters
;
json
[
k_parameters
]
=
this
->
parameters
.
toJson
();
return
json
;
}
...
...
worker/src/RTC/RtpDictionaries/RtpHeaderExtensionParameters.cpp
浏览文件 @
74e30699
...
...
@@ -40,7 +40,7 @@ namespace RTC
// `parameters` is optional.
if
(
data
[
k_parameters
].
isObject
())
RTC
::
FillCustomParameters
(
this
->
parameters
,
data
[
k_parameters
]);
this
->
parameters
.
Set
(
data
[
k_parameters
]);
}
Json
::
Value
RtpHeaderExtensionParameters
::
toJson
()
...
...
@@ -64,17 +64,7 @@ namespace RTC
json
[
k_encrypt
]
=
this
->
encrypt
;
// Add `parameters`.
Json
::
Value
json_parameters
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
parameters
)
{
const
std
::
string
&
key
=
kv
.
first
;
auto
&
parameterValue
=
kv
.
second
;
json_parameters
[
key
]
=
parameterValue
.
toJson
();
}
json
[
k_parameters
]
=
json_parameters
;
json
[
k_parameters
]
=
this
->
parameters
.
toJson
();
return
json
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论