Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
d0a9c57d
提交
d0a9c57d
authored
10月 06, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GetStats implementation
上级
5fc053d4
显示空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
342 行增加
和
35 行删除
+342
-35
Consumer.js
lib/Consumer.js
+27
-0
Producer.js
lib/Producer.js
+27
-0
WebRtcTransport.js
lib/WebRtcTransport.js
+27
-0
Request.hpp
worker/include/Channel/Request.hpp
+3
-0
Consumer.hpp
worker/include/RTC/Consumer.hpp
+1
-0
PlainRtpTransport.hpp
worker/include/RTC/PlainRtpTransport.hpp
+1
-0
Producer.hpp
worker/include/RTC/Producer.hpp
+1
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+3
-0
Transport.hpp
worker/include/RTC/Transport.hpp
+1
-0
WebRtcTransport.hpp
worker/include/RTC/WebRtcTransport.hpp
+1
-0
Request.cpp
worker/src/Channel/Request.cpp
+4
-1
Consumer.cpp
worker/src/RTC/Consumer.cpp
+23
-0
PlainRtpTransport.cpp
worker/src/RTC/PlainRtpTransport.cpp
+9
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+24
-0
Router.cpp
worker/src/RTC/Router.cpp
+66
-0
RtpStream.cpp
worker/src/RTC/RtpStream.cpp
+7
-2
RtpStreamRecv.cpp
worker/src/RTC/RtpStreamRecv.cpp
+1
-1
RtpStreamSend.cpp
worker/src/RTC/RtpStreamSend.cpp
+2
-2
TransportTuple.cpp
worker/src/RTC/TransportTuple.cpp
+0
-4
WebRtcTransport.cpp
worker/src/RTC/WebRtcTransport.cpp
+111
-25
Worker.cpp
worker/src/Worker.cpp
+3
-0
没有找到文件。
lib/Consumer.js
浏览文件 @
d0a9c57d
...
@@ -250,6 +250,33 @@ class Consumer extends EnhancedEventEmitter
...
@@ -250,6 +250,33 @@ class Consumer extends EnhancedEventEmitter
});
});
}
}
/**
* Get the Consumer stats.
*
* @return {Promise}
*/
getStats
()
{
logger
.
debug
(
'getStats()'
);
if
(
this
.
_closed
)
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Consumer closed'
));
return
this
.
_channel
.
request
(
'consumer.getStats'
,
this
.
_internal
)
.
then
((
data
)
=>
{
logger
.
debug
(
'"consumer.getStats" request succeeded'
);
return
data
;
})
.
catch
((
error
)
=>
{
logger
.
error
(
'"consumer.getStats" request failed: %s'
,
String
(
error
));
throw
error
;
});
}
toJson
()
toJson
()
{
{
const
json
=
const
json
=
...
...
lib/Producer.js
浏览文件 @
d0a9c57d
...
@@ -247,6 +247,33 @@ class Producer extends EnhancedEventEmitter
...
@@ -247,6 +247,33 @@ class Producer extends EnhancedEventEmitter
});
});
}
}
/**
* Get the Producer stats.
*
* @return {Promise}
*/
getStats
()
{
logger
.
debug
(
'getStats()'
);
if
(
this
.
_closed
)
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Producer closed'
));
return
this
.
_channel
.
request
(
'producer.getStats'
,
this
.
_internal
)
.
then
((
data
)
=>
{
logger
.
debug
(
'"producer.getStats" request succeeded'
);
return
data
;
})
.
catch
((
error
)
=>
{
logger
.
error
(
'"producer.getStats" request failed: %s'
,
String
(
error
));
throw
error
;
});
}
/**
/**
* Pauses receiving media.
* Pauses receiving media.
*
*
...
...
lib/WebRtcTransport.js
浏览文件 @
d0a9c57d
...
@@ -232,6 +232,33 @@ class WebRtcTransport extends EnhancedEventEmitter
...
@@ -232,6 +232,33 @@ class WebRtcTransport extends EnhancedEventEmitter
});
});
}
}
/**
* Get the WebRtcTransport stats.
*
* @return {Promise}
*/
getStats
()
{
logger
.
debug
(
'getStats()'
);
if
(
this
.
_closed
)
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'WebRtcTransport closed'
));
return
this
.
_channel
.
request
(
'transport.getStats'
,
this
.
_internal
)
.
then
((
data
)
=>
{
logger
.
debug
(
'"transport.getStats" request succeeded'
);
return
data
;
})
.
catch
((
error
)
=>
{
logger
.
error
(
'"transport.getStats" request failed: %s'
,
String
(
error
));
throw
error
;
});
}
/**
/**
* Provide the remote DTLS parameters.
* Provide the remote DTLS parameters.
*
*
...
...
worker/include/Channel/Request.hpp
浏览文件 @
d0a9c57d
...
@@ -29,6 +29,7 @@ namespace Channel
...
@@ -29,6 +29,7 @@ namespace Channel
ROUTER_SET_AUDIO_LEVELS_EVENT
,
ROUTER_SET_AUDIO_LEVELS_EVENT
,
TRANSPORT_CLOSE
,
TRANSPORT_CLOSE
,
TRANSPORT_DUMP
,
TRANSPORT_DUMP
,
TRANSPORT_GET_STATS
,
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
,
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
,
TRANSPORT_SET_MAX_BITRATE
,
TRANSPORT_SET_MAX_BITRATE
,
TRANSPORT_CHANGE_UFRAG_PWD
,
TRANSPORT_CHANGE_UFRAG_PWD
,
...
@@ -36,12 +37,14 @@ namespace Channel
...
@@ -36,12 +37,14 @@ namespace Channel
TRANSPORT_STOP_MIRRORING
,
TRANSPORT_STOP_MIRRORING
,
PRODUCER_CLOSE
,
PRODUCER_CLOSE
,
PRODUCER_DUMP
,
PRODUCER_DUMP
,
PRODUCER_GET_STATS
,
PRODUCER_UPDATE_RTP_PARAMETERS
,
PRODUCER_UPDATE_RTP_PARAMETERS
,
PRODUCER_PAUSE
,
PRODUCER_PAUSE
,
PRODUCER_RESUME
,
PRODUCER_RESUME
,
PRODUCER_SET_PREFERRED_PROFILE
,
PRODUCER_SET_PREFERRED_PROFILE
,
CONSUMER_CLOSE
,
CONSUMER_CLOSE
,
CONSUMER_DUMP
,
CONSUMER_DUMP
,
CONSUMER_GET_STATS
,
CONSUMER_ENABLE
,
CONSUMER_ENABLE
,
CONSUMER_PAUSE
,
CONSUMER_PAUSE
,
CONSUMER_RESUME
,
CONSUMER_RESUME
,
...
...
worker/include/RTC/Consumer.hpp
浏览文件 @
d0a9c57d
...
@@ -36,6 +36,7 @@ namespace RTC
...
@@ -36,6 +36,7 @@ namespace RTC
public
:
public
:
void
Destroy
();
void
Destroy
();
Json
::
Value
ToJson
()
const
;
Json
::
Value
ToJson
()
const
;
Json
::
Value
GetStats
()
const
;
void
AddListener
(
RTC
::
ConsumerListener
*
listener
);
void
AddListener
(
RTC
::
ConsumerListener
*
listener
);
void
RemoveListener
(
RTC
::
ConsumerListener
*
listener
);
void
RemoveListener
(
RTC
::
ConsumerListener
*
listener
);
void
Enable
(
RTC
::
Transport
*
transport
,
RTC
::
RtpParameters
&
rtpParameters
);
void
Enable
(
RTC
::
Transport
*
transport
,
RTC
::
RtpParameters
&
rtpParameters
);
...
...
worker/include/RTC/PlainRtpTransport.hpp
浏览文件 @
d0a9c57d
...
@@ -30,6 +30,7 @@ namespace RTC
...
@@ -30,6 +30,7 @@ namespace RTC
public
:
public
:
Json
::
Value
ToJson
()
const
override
;
Json
::
Value
ToJson
()
const
override
;
Json
::
Value
GetStats
()
const
override
;
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
override
;
void
SendRtcpPacket
(
RTC
::
RTCP
::
Packet
*
packet
)
override
;
void
SendRtcpPacket
(
RTC
::
RTCP
::
Packet
*
packet
)
override
;
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
d0a9c57d
...
@@ -55,6 +55,7 @@ namespace RTC
...
@@ -55,6 +55,7 @@ namespace RTC
public
:
public
:
void
Destroy
();
void
Destroy
();
Json
::
Value
ToJson
()
const
;
Json
::
Value
ToJson
()
const
;
Json
::
Value
GetStats
()
const
;
void
AddListener
(
RTC
::
ProducerListener
*
listener
);
void
AddListener
(
RTC
::
ProducerListener
*
listener
);
void
RemoveListener
(
RTC
::
ProducerListener
*
listener
);
void
RemoveListener
(
RTC
::
ProducerListener
*
listener
);
void
UpdateRtpParameters
(
RTC
::
RtpParameters
&
rtpParameters
);
void
UpdateRtpParameters
(
RTC
::
RtpParameters
&
rtpParameters
);
...
...
worker/include/RTC/RtpStream.hpp
浏览文件 @
d0a9c57d
...
@@ -97,6 +97,9 @@ namespace RTC
...
@@ -97,6 +97,9 @@ namespace RTC
Timer
*
healthCheckTimer
{
nullptr
};
Timer
*
healthCheckTimer
{
nullptr
};
bool
healthy
{
true
};
bool
healthy
{
true
};
bool
notifyHealth
{
true
};
bool
notifyHealth
{
true
};
private
:
std
::
string
rtpStreamId
{};
};
};
/* Inline instance methods. */
/* Inline instance methods. */
...
...
worker/include/RTC/Transport.hpp
浏览文件 @
d0a9c57d
...
@@ -72,6 +72,7 @@ namespace RTC
...
@@ -72,6 +72,7 @@ namespace RTC
public
:
public
:
void
Destroy
();
void
Destroy
();
virtual
Json
::
Value
ToJson
()
const
=
0
;
virtual
Json
::
Value
ToJson
()
const
=
0
;
virtual
Json
::
Value
GetStats
()
const
=
0
;
void
HandleProducer
(
RTC
::
Producer
*
producer
);
void
HandleProducer
(
RTC
::
Producer
*
producer
);
void
HandleConsumer
(
RTC
::
Consumer
*
consumer
);
void
HandleConsumer
(
RTC
::
Consumer
*
consumer
);
virtual
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
=
0
;
virtual
void
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
=
0
;
...
...
worker/include/RTC/WebRtcTransport.hpp
浏览文件 @
d0a9c57d
...
@@ -48,6 +48,7 @@ namespace RTC
...
@@ -48,6 +48,7 @@ namespace RTC
public
:
public
:
Json
::
Value
ToJson
()
const
override
;
Json
::
Value
ToJson
()
const
override
;
Json
::
Value
GetStats
()
const
override
;
RTC
::
DtlsTransport
::
Role
SetRemoteDtlsParameters
(
RTC
::
DtlsTransport
::
Role
SetRemoteDtlsParameters
(
RTC
::
DtlsTransport
::
Fingerprint
&
fingerprint
,
RTC
::
DtlsTransport
::
Role
role
);
RTC
::
DtlsTransport
::
Fingerprint
&
fingerprint
,
RTC
::
DtlsTransport
::
Role
role
);
void
SetMaxBitrate
(
uint32_t
bitrate
);
void
SetMaxBitrate
(
uint32_t
bitrate
);
...
...
worker/src/Channel/Request.cpp
浏览文件 @
d0a9c57d
...
@@ -24,6 +24,7 @@ namespace Channel
...
@@ -24,6 +24,7 @@ namespace Channel
{
"router.setAudioLevelsEvent"
,
Request
::
MethodId
::
ROUTER_SET_AUDIO_LEVELS_EVENT
},
{
"router.setAudioLevelsEvent"
,
Request
::
MethodId
::
ROUTER_SET_AUDIO_LEVELS_EVENT
},
{
"transport.close"
,
Request
::
MethodId
::
TRANSPORT_CLOSE
},
{
"transport.close"
,
Request
::
MethodId
::
TRANSPORT_CLOSE
},
{
"transport.dump"
,
Request
::
MethodId
::
TRANSPORT_DUMP
},
{
"transport.dump"
,
Request
::
MethodId
::
TRANSPORT_DUMP
},
{
"transport.getStats"
,
Request
::
MethodId
::
TRANSPORT_GET_STATS
},
{
"transport.setRemoteDtlsParameters"
,
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
},
{
"transport.setRemoteDtlsParameters"
,
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
},
{
"transport.setMaxBitrate"
,
Request
::
MethodId
::
TRANSPORT_SET_MAX_BITRATE
},
{
"transport.setMaxBitrate"
,
Request
::
MethodId
::
TRANSPORT_SET_MAX_BITRATE
},
{
"transport.changeUfragPwd"
,
Request
::
MethodId
::
TRANSPORT_CHANGE_UFRAG_PWD
},
{
"transport.changeUfragPwd"
,
Request
::
MethodId
::
TRANSPORT_CHANGE_UFRAG_PWD
},
...
@@ -31,12 +32,14 @@ namespace Channel
...
@@ -31,12 +32,14 @@ namespace Channel
{
"transport.stopMirroring"
,
Request
::
MethodId
::
TRANSPORT_STOP_MIRRORING
},
{
"transport.stopMirroring"
,
Request
::
MethodId
::
TRANSPORT_STOP_MIRRORING
},
{
"producer.close"
,
Request
::
MethodId
::
PRODUCER_CLOSE
},
{
"producer.close"
,
Request
::
MethodId
::
PRODUCER_CLOSE
},
{
"producer.dump"
,
Request
::
MethodId
::
PRODUCER_DUMP
},
{
"producer.dump"
,
Request
::
MethodId
::
PRODUCER_DUMP
},
{
"producer.getStats"
,
Request
::
MethodId
::
PRODUCER_GET_STATS
},
{
"producer.updateRtpParameters"
,
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
},
{
"producer.updateRtpParameters"
,
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
},
{
"producer.pause"
,
Request
::
MethodId
::
PRODUCER_PAUSE
},
{
"producer.pause"
,
Request
::
MethodId
::
PRODUCER_PAUSE
},
{
"producer.resume"
,
Request
::
MethodId
::
PRODUCER_RESUME
},
{
"producer.resume"
,
Request
::
MethodId
::
PRODUCER_RESUME
},
{
"producer.setPreferredProfile"
,
Request
::
MethodId
::
PRODUCER_SET_PREFERRED_PROFILE
},
{
"producer.setPreferredProfile"
,
Request
::
MethodId
::
PRODUCER_SET_PREFERRED_PROFILE
},
{
"consumer.close"
,
Request
::
MethodId
::
CONSUMER_CLOSE
},
{
"consumer.close"
,
Request
::
MethodId
::
CONSUMER_CLOSE
},
{
"consumer.dump"
,
Request
::
MethodId
::
CONSUMER_DUMP
},
{
"consumer.dump"
,
Request
::
MethodId
::
CONSUMER_DUMP
},
{
"consumer.getStats"
,
Request
::
MethodId
::
CONSUMER_GET_STATS
},
{
"consumer.enable"
,
Request
::
MethodId
::
CONSUMER_ENABLE
},
{
"consumer.enable"
,
Request
::
MethodId
::
CONSUMER_ENABLE
},
{
"consumer.pause"
,
Request
::
MethodId
::
CONSUMER_PAUSE
},
{
"consumer.pause"
,
Request
::
MethodId
::
CONSUMER_PAUSE
},
{
"consumer.resume"
,
Request
::
MethodId
::
CONSUMER_RESUME
},
{
"consumer.resume"
,
Request
::
MethodId
::
CONSUMER_RESUME
},
...
@@ -122,7 +125,7 @@ namespace Channel
...
@@ -122,7 +125,7 @@ namespace Channel
json
[
JsonStringId
]
=
Json
::
UInt
{
this
->
id
};
json
[
JsonStringId
]
=
Json
::
UInt
{
this
->
id
};
json
[
JsonStringAccepted
]
=
true
;
json
[
JsonStringAccepted
]
=
true
;
if
(
data
.
isObject
())
if
(
data
.
isObject
()
||
data
.
isArray
()
)
json
[
JsonStringData
]
=
data
;
json
[
JsonStringData
]
=
data
;
else
else
json
[
JsonStringData
]
=
emptyData
;
json
[
JsonStringData
]
=
emptyData
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
d0a9c57d
...
@@ -101,6 +101,29 @@ namespace RTC
...
@@ -101,6 +101,29 @@ namespace RTC
return
json
;
return
json
;
}
}
Json
::
Value
Consumer
::
GetStats
()
const
{
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringTransportId
{
"transportId"
};
Json
::
Value
json
(
Json
::
arrayValue
);
if
(
this
->
rtpStream
!=
nullptr
)
{
auto
jsonRtpStream
=
this
->
rtpStream
->
GetStats
();
if
(
this
->
transport
!=
nullptr
)
{
jsonRtpStream
[
JsonStringTransportId
]
=
this
->
transport
->
transportId
;
}
json
.
append
(
jsonRtpStream
);
}
return
json
;
}
/**
/**
* A Transport has been assigned, and hence sending RTP parameters.
* A Transport has been assigned, and hence sending RTP parameters.
*/
*/
...
...
worker/src/RTC/PlainRtpTransport.cpp
浏览文件 @
d0a9c57d
...
@@ -106,6 +106,15 @@ namespace RTC
...
@@ -106,6 +106,15 @@ namespace RTC
return
json
;
return
json
;
}
}
Json
::
Value
PlainRtpTransport
::
GetStats
()
const
{
MS_TRACE
();
Json
::
Value
json
(
Json
::
objectValue
);
return
json
;
}
void
PlainRtpTransport
::
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
void
PlainRtpTransport
::
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
d0a9c57d
...
@@ -127,6 +127,30 @@ namespace RTC
...
@@ -127,6 +127,30 @@ namespace RTC
return
json
;
return
json
;
}
}
Json
::
Value
Producer
::
GetStats
()
const
{
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringTransportId
{
"transportId"
};
Json
::
Value
json
(
Json
::
arrayValue
);
for
(
auto
it
:
this
->
rtpStreams
)
{
auto
rtpStream
=
it
.
second
;
auto
jsonRtpStream
=
rtpStream
->
GetStats
();
if
(
this
->
transport
!=
nullptr
)
{
jsonRtpStream
[
JsonStringTransportId
]
=
this
->
transport
->
transportId
;
}
json
.
append
(
jsonRtpStream
);
}
return
json
;
}
void
Producer
::
UpdateRtpParameters
(
RTC
::
RtpParameters
&
rtpParameters
)
void
Producer
::
UpdateRtpParameters
(
RTC
::
RtpParameters
&
rtpParameters
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/Router.cpp
浏览文件 @
d0a9c57d
...
@@ -623,6 +623,28 @@ namespace RTC
...
@@ -623,6 +623,28 @@ namespace RTC
break
;
break
;
}
}
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_GET_STATS
:
{
RTC
::
Transport
*
transport
;
try
{
transport
=
GetTransportFromRequest
(
request
);
}
catch
(
const
MediaSoupError
&
error
)
{
request
->
Reject
(
error
.
what
());
return
;
}
auto
json
=
transport
->
GetStats
();
request
->
Accept
(
json
);
break
;
}
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
:
{
{
static
const
Json
::
StaticString
JsonStringRole
{
"role"
};
static
const
Json
::
StaticString
JsonStringRole
{
"role"
};
...
@@ -927,6 +949,28 @@ namespace RTC
...
@@ -927,6 +949,28 @@ namespace RTC
break
;
break
;
}
}
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_GET_STATS
:
{
RTC
::
Producer
*
producer
;
try
{
producer
=
GetProducerFromRequest
(
request
);
}
catch
(
const
MediaSoupError
&
error
)
{
request
->
Reject
(
error
.
what
());
return
;
}
auto
json
=
producer
->
GetStats
();
request
->
Accept
(
json
);
break
;
}
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
:
{
{
static
const
Json
::
StaticString
JsonStringRtpParameters
{
"rtpParameters"
};
static
const
Json
::
StaticString
JsonStringRtpParameters
{
"rtpParameters"
};
...
@@ -1183,6 +1227,28 @@ namespace RTC
...
@@ -1183,6 +1227,28 @@ namespace RTC
break
;
break
;
}
}
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_GET_STATS
:
{
RTC
::
Consumer
*
consumer
;
try
{
consumer
=
GetConsumerFromRequest
(
request
);
}
catch
(
const
MediaSoupError
&
error
)
{
request
->
Reject
(
error
.
what
());
return
;
}
auto
json
=
consumer
->
GetStats
();
request
->
Accept
(
json
);
break
;
}
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_PAUSE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_PAUSE
:
{
{
RTC
::
Consumer
*
consumer
;
RTC
::
Consumer
*
consumer
;
...
...
worker/src/RTC/RtpStream.cpp
浏览文件 @
d0a9c57d
...
@@ -21,6 +21,9 @@ namespace RTC
...
@@ -21,6 +21,9 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Generate a random rtpStreamId.
this
->
rtpStreamId
=
Utils
::
Crypto
::
GetRandomString
(
16
);
// Set the health check timer.
// Set the health check timer.
this
->
healthCheckTimer
=
new
Timer
(
this
);
this
->
healthCheckTimer
=
new
Timer
(
this
);
...
@@ -41,12 +44,10 @@ namespace RTC
...
@@ -41,12 +44,10 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringParams
{
"params"
};
static
const
Json
::
StaticString
JsonStringStats
{
"stats"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringParams
]
=
this
->
params
.
ToJson
();
json
[
JsonStringStats
]
=
GetStats
();
return
json
;
return
json
;
}
}
...
@@ -55,9 +56,11 @@ namespace RTC
...
@@ -55,9 +56,11 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
static
const
Json
::
StaticString
JsonStringId
{
"id"
};
static
const
Json
::
StaticString
JsonStringTimestamp
{
"timestamp"
};
static
const
Json
::
StaticString
JsonStringTimestamp
{
"timestamp"
};
static
const
Json
::
StaticString
JsonStringSsrc
{
"ssrc"
};
static
const
Json
::
StaticString
JsonStringSsrc
{
"ssrc"
};
static
const
Json
::
StaticString
JsonStringMediaType
{
"mediaType"
};
static
const
Json
::
StaticString
JsonStringMediaType
{
"mediaType"
};
static
const
Json
::
StaticString
JsonStringMimeType
{
"mimeType"
};
static
const
Json
::
StaticString
JsonStringHealthy
{
"healthy"
};
static
const
Json
::
StaticString
JsonStringHealthy
{
"healthy"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringPacketCount
{
"packetCount"
};
static
const
Json
::
StaticString
JsonStringByteCount
{
"byteCount"
};
static
const
Json
::
StaticString
JsonStringByteCount
{
"byteCount"
};
...
@@ -74,9 +77,11 @@ namespace RTC
...
@@ -74,9 +77,11 @@ namespace RTC
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
uint64_t
now
=
DepLibUV
::
GetTime
();
uint64_t
now
=
DepLibUV
::
GetTime
();
json
[
JsonStringId
]
=
this
->
rtpStreamId
;
json
[
JsonStringTimestamp
]
=
Json
::
UInt64
{
now
};
json
[
JsonStringTimestamp
]
=
Json
::
UInt64
{
now
};
json
[
JsonStringSsrc
]
=
Json
::
UInt
{
this
->
params
.
ssrc
};
json
[
JsonStringSsrc
]
=
Json
::
UInt
{
this
->
params
.
ssrc
};
json
[
JsonStringMediaType
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
json
[
JsonStringMediaType
]
=
RtpCodecMimeType
::
type2String
[
this
->
params
.
mimeType
.
type
];
json
[
JsonStringMimeType
]
=
this
->
params
.
mimeType
.
ToString
();
json
[
JsonStringHealthy
]
=
this
->
healthy
?
"true"
:
"false"
;
json
[
JsonStringHealthy
]
=
this
->
healthy
?
"true"
:
"false"
;
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetPacketCount
());
json
[
JsonStringPacketCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetPacketCount
());
json
[
JsonStringByteCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetBytes
());
json
[
JsonStringByteCount
]
=
static_cast
<
Json
::
UInt
>
(
this
->
transmissionCounter
.
GetBytes
());
...
...
worker/src/RTC/RtpStreamRecv.cpp
浏览文件 @
d0a9c57d
...
@@ -26,7 +26,7 @@ namespace RTC
...
@@ -26,7 +26,7 @@ namespace RTC
Json
::
Value
RtpStreamRecv
::
GetStats
()
Json
::
Value
RtpStreamRecv
::
GetStats
()
{
{
static
const
std
::
string
Type
=
"inboundrtp"
;
static
const
std
::
string
Type
=
"inbound
-
rtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
static
const
Json
::
StaticString
JsonStringJitter
{
"jitter"
};
...
...
worker/src/RTC/RtpStreamSend.cpp
浏览文件 @
d0a9c57d
...
@@ -36,9 +36,9 @@ namespace RTC
...
@@ -36,9 +36,9 @@ namespace RTC
Json
::
Value
RtpStreamSend
::
GetStats
()
Json
::
Value
RtpStreamSend
::
GetStats
()
{
{
static
const
std
::
string
Type
=
"outboundrtp"
;
static
const
std
::
string
Type
=
"outbound
-
rtp"
;
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringRtt
{
"r
tt
"
};
static
const
Json
::
StaticString
JsonStringRtt
{
"r
oundTripTime
"
};
Json
::
Value
json
=
RtpStream
::
GetStats
();
Json
::
Value
json
=
RtpStream
::
GetStats
();
...
...
worker/src/RTC/TransportTuple.cpp
浏览文件 @
d0a9c57d
...
@@ -21,8 +21,6 @@ namespace RTC
...
@@ -21,8 +21,6 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringProtocol
{
"protocol"
};
static
const
Json
::
StaticString
JsonStringProtocol
{
"protocol"
};
static
const
Json
::
StaticString
JsonStringUdp
{
"udp"
};
static
const
Json
::
StaticString
JsonStringUdp
{
"udp"
};
static
const
Json
::
StaticString
JsonStringTcp
{
"tcp"
};
static
const
Json
::
StaticString
JsonStringTcp
{
"tcp"
};
static
const
Json
::
StaticString
JsonStringRecvBytes
{
"recvBytes"
};
static
const
Json
::
StaticString
JsonStringSentBytes
{
"sentBytes"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
int
ipFamily
;
int
ipFamily
;
...
@@ -40,8 +38,6 @@ namespace RTC
...
@@ -40,8 +38,6 @@ namespace RTC
Utils
::
IP
::
GetAddressInfo
(
this
->
GetRemoteAddress
(),
&
ipFamily
,
ip
,
&
port
);
Utils
::
IP
::
GetAddressInfo
(
this
->
GetRemoteAddress
(),
&
ipFamily
,
ip
,
&
port
);
json
[
JsonStringRemoteIp
]
=
ip
;
json
[
JsonStringRemoteIp
]
=
ip
;
json
[
JsonStringRemotePort
]
=
Json
::
UInt
{
port
};
json
[
JsonStringRemotePort
]
=
Json
::
UInt
{
port
};
json
[
JsonStringRecvBytes
]
=
Json
::
UInt64
{
GetRecvBytes
()
};
json
[
JsonStringSentBytes
]
=
Json
::
UInt64
{
GetSentBytes
()
};
return
json
;
return
json
;
}
}
...
...
worker/src/RTC/WebRtcTransport.cpp
浏览文件 @
d0a9c57d
...
@@ -240,13 +240,6 @@ namespace RTC
...
@@ -240,13 +240,6 @@ namespace RTC
static
const
Json
::
StaticString
JsonStringHeaderExtensionIds
{
"headerExtensionIds"
};
static
const
Json
::
StaticString
JsonStringHeaderExtensionIds
{
"headerExtensionIds"
};
static
const
Json
::
StaticString
JsonStringAbsSendTime
{
"absSendTime"
};
static
const
Json
::
StaticString
JsonStringAbsSendTime
{
"absSendTime"
};
static
const
Json
::
StaticString
JsonStringRid
{
"rid"
};
static
const
Json
::
StaticString
JsonStringRid
{
"rid"
};
static
const
Json
::
StaticString
JsonStringSentRemb
{
"sentRemb"
};
static
const
Json
::
StaticString
JsonStringSentRembMaxBitrate
{
"maxBitrate"
};
static
const
Json
::
StaticString
JsonStringSentRembBitrate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringSentRembSsrcs
{
"ssrcs"
};
static
const
Json
::
StaticString
JsonStringRecvRemb
{
"recvRemb"
};
static
const
Json
::
StaticString
JsonStringRecvRembBitrate
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringRecvRembSsrcs
{
"ssrcs"
};
static
const
Json
::
StaticString
JsonStringRtpListener
{
"rtpListener"
};
static
const
Json
::
StaticString
JsonStringRtpListener
{
"rtpListener"
};
Json
::
Value
json
(
Json
::
objectValue
);
Json
::
Value
json
(
Json
::
objectValue
);
...
@@ -341,38 +334,131 @@ namespace RTC
...
@@ -341,38 +334,131 @@ namespace RTC
json
[
JsonStringHeaderExtensionIds
]
=
jsonHeaderExtensionIds
;
json
[
JsonStringHeaderExtensionIds
]
=
jsonHeaderExtensionIds
;
// Add sendRemb
// Add rtpListener.
Json
::
Value
jsonSentRemb
(
Json
::
objectValue
);
json
[
JsonStringRtpListener
]
=
this
->
rtpListener
.
ToJson
();
Json
::
Value
jsonSentRembSsrcs
(
Json
::
arrayValue
);
return
json
;
}
Json
::
Value
WebRtcTransport
::
GetStats
()
const
{
MS_TRACE
();
static
const
std
::
string
type
(
"transport"
);
static
const
Json
::
StaticString
JsonStringType
{
"type"
};
static
const
Json
::
StaticString
JsonStringTimestamp
{
"timestamp"
};
static
const
Json
::
StaticString
JsonStringId
{
"id"
};
static
const
Json
::
StaticString
JsonStringBytesReceived
{
"bytesReceived"
};
static
const
Json
::
StaticString
JsonStringBytesSent
{
"bytesSent"
};
static
const
Json
::
StaticString
JsonStringIceSelectedTuple
{
"iceSelectedTuple"
};
static
const
Json
::
StaticString
JsonStringDtlsState
{
"dtlsState"
};
static
const
Json
::
StaticString
JsonStringIceConnectionState
{
"iceConnectionState"
};
// DTLS states.
static
const
Json
::
StaticString
JsonStringNew
{
"new"
};
static
const
Json
::
StaticString
JsonStringConnecting
{
"connecting"
};
static
const
Json
::
StaticString
JsonStringConnected
{
"connected"
};
static
const
Json
::
StaticString
JsonStringClosed
{
"closed"
};
static
const
Json
::
StaticString
JsonStringFailed
{
"failed"
};
// ICE connection states.
static
const
Json
::
StaticString
JsonStringCompleted
{
"completed"
};
static
const
Json
::
StaticString
JsonStringDisconnected
{
"disconnected"
};
// Available send bandwidth.
static
const
Json
::
StaticString
JsonStringLocalAvailableSendBw
{
"localAvailableSendBw"
};
static
const
Json
::
StaticString
JsonStringLocalAvailableSendBwMaxValue
{
"maxBitrate"
};
static
const
Json
::
StaticString
JsonStringLocalAvailableSendBwValue
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringLocalAvailableSendBwSsrcs
{
"ssrcs"
};
static
const
Json
::
StaticString
JsonStringRemoteAvailableSendBw
{
"remoteAvailableSendBw"
};
static
const
Json
::
StaticString
JsonStringRemoteAvailableSendBwValue
{
"bitrate"
};
static
const
Json
::
StaticString
JsonStringRemoteAvailableSendBwSsrcs
{
"ssrcs"
};
Json
::
Value
json
(
Json
::
objectValue
);
jsonSentRemb
[
JsonStringSentRembMaxBitrate
]
=
Json
::
UInt
{
this
->
maxBitrate
};
json
[
JsonStringType
]
=
type
;
json
[
JsonStringTimestamp
]
=
Json
::
UInt64
{
DepLibUV
::
GetTime
()
};
json
[
JsonStringId
]
=
Json
::
UInt
{
this
->
transportId
};
jsonSentRemb
[
JsonStringSentRembBitrate
]
=
Json
::
UInt64
{
std
::
get
<
0
>
(
this
->
sentRemb
)
};
if
(
this
->
selectedTuple
!=
nullptr
)
{
// 'bytesReceived'.
json
[
JsonStringBytesReceived
]
=
Json
::
UInt64
{
this
->
selectedTuple
->
GetRecvBytes
()
};
// 'bytesSent'.
json
[
JsonStringBytesSent
]
=
Json
::
UInt64
{
this
->
selectedTuple
->
GetSentBytes
()
};
json
[
JsonStringIceSelectedTuple
]
=
this
->
selectedTuple
->
ToJson
();
}
// 'dtlsState'.
switch
(
this
->
dtlsTransport
->
GetState
())
{
case
DtlsTransport
:
:
DtlsState
::
NEW
:
json
[
JsonStringDtlsState
]
=
JsonStringNew
;
break
;
case
DtlsTransport
:
:
DtlsState
::
CONNECTING
:
json
[
JsonStringDtlsState
]
=
JsonStringConnecting
;
break
;
case
DtlsTransport
:
:
DtlsState
::
CONNECTED
:
json
[
JsonStringDtlsState
]
=
JsonStringConnected
;
break
;
case
DtlsTransport
:
:
DtlsState
::
FAILED
:
json
[
JsonStringDtlsState
]
=
JsonStringFailed
;
break
;
case
DtlsTransport
:
:
DtlsState
::
CLOSED
:
json
[
JsonStringDtlsState
]
=
JsonStringClosed
;
break
;
}
// 'iceConnectionState'.
switch
(
this
->
iceServer
->
GetState
())
{
case
RTC
:
:
IceServer
::
IceState
::
NEW
:
json
[
JsonStringIceConnectionState
]
=
JsonStringNew
;
break
;
case
RTC
:
:
IceServer
::
IceState
::
CONNECTED
:
json
[
JsonStringIceConnectionState
]
=
JsonStringConnected
;
break
;
case
RTC
:
:
IceServer
::
IceState
::
COMPLETED
:
json
[
JsonStringIceConnectionState
]
=
JsonStringCompleted
;
break
;
case
RTC
:
:
IceServer
::
IceState
::
DISCONNECTED
:
json
[
JsonStringIceConnectionState
]
=
JsonStringDisconnected
;
break
;
}
// Add local available send bandwidth.
Json
::
Value
jsonLocalAvailableSendBw
(
Json
::
objectValue
);
Json
::
Value
jsonLocalAvailableSendBwSsrcs
(
Json
::
arrayValue
);
jsonLocalAvailableSendBw
[
JsonStringLocalAvailableSendBwMaxValue
]
=
Json
::
UInt
{
this
->
maxBitrate
};
jsonLocalAvailableSendBw
[
JsonStringLocalAvailableSendBwValue
]
=
Json
::
UInt64
{
std
::
get
<
0
>
(
this
->
sentRemb
)
};
for
(
auto
ssrc
:
std
::
get
<
1
>
(
this
->
sentRemb
))
for
(
auto
ssrc
:
std
::
get
<
1
>
(
this
->
sentRemb
))
json
SentRemb
Ssrcs
.
append
(
ssrc
);
json
LocalAvailableSendBw
Ssrcs
.
append
(
ssrc
);
json
SentRemb
[
JsonStringSentRembSsrcs
]
=
jsonSentRemb
Ssrcs
;
json
LocalAvailableSendBw
[
JsonStringLocalAvailableSendBwSsrcs
]
=
jsonLocalAvailableSendBw
Ssrcs
;
json
[
JsonString
SentRemb
]
=
jsonSentRemb
;
json
[
JsonString
LocalAvailableSendBw
]
=
jsonLocalAvailableSendBw
;
// Add re
cvRemb
// Add re
mote available send bandwidth.
Json
::
Value
jsonRe
cvRemb
(
Json
::
objectValue
);
Json
::
Value
jsonRe
moteAvailableSendBw
(
Json
::
objectValue
);
Json
::
Value
jsonRe
cvRemb
Ssrcs
(
Json
::
arrayValue
);
Json
::
Value
jsonRe
moteAvailableSendBw
Ssrcs
(
Json
::
arrayValue
);
jsonRecvRemb
[
JsonStringRecvRembBitrate
]
=
Json
::
UInt64
{
std
::
get
<
0
>
(
this
->
recvRemb
)
};
jsonRemoteAvailableSendBw
[
JsonStringRemoteAvailableSendBwValue
]
=
Json
::
UInt64
{
std
::
get
<
0
>
(
this
->
recvRemb
)
};
for
(
auto
ssrc
:
std
::
get
<
1
>
(
this
->
recvRemb
))
for
(
auto
ssrc
:
std
::
get
<
1
>
(
this
->
recvRemb
))
jsonRe
cvRemb
Ssrcs
.
append
(
ssrc
);
jsonRe
moteAvailableSendBw
Ssrcs
.
append
(
ssrc
);
jsonRe
cvRemb
[
JsonStringRecvRembSsrcs
]
=
jsonRecvRemb
Ssrcs
;
jsonRe
moteAvailableSendBw
[
JsonStringRemoteAvailableSendBwSsrcs
]
=
jsonRemoteAvailableSendBw
Ssrcs
;
json
[
JsonStringRe
cvRemb
]
=
jsonRecvRemb
;
json
[
JsonStringRe
moteAvailableSendBw
]
=
jsonRemoteAvailableSendBw
;
// Add rtpListener.
Json
::
Value
array
(
Json
::
arrayValue
);
json
[
JsonStringRtpListener
]
=
this
->
rtpListener
.
ToJson
();
return
json
;
array
.
append
(
json
);
return
array
;
}
}
RTC
::
DtlsTransport
::
Role
WebRtcTransport
::
SetRemoteDtlsParameters
(
RTC
::
DtlsTransport
::
Role
WebRtcTransport
::
SetRemoteDtlsParameters
(
...
...
worker/src/Worker.cpp
浏览文件 @
d0a9c57d
...
@@ -245,6 +245,7 @@ void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Channel::R
...
@@ -245,6 +245,7 @@ void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Channel::R
case
Channel
:
:
Request
::
MethodId
::
ROUTER_SET_AUDIO_LEVELS_EVENT
:
case
Channel
:
:
Request
::
MethodId
::
ROUTER_SET_AUDIO_LEVELS_EVENT
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_GET_STATS
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_REMOTE_DTLS_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_MAX_BITRATE
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_SET_MAX_BITRATE
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_CHANGE_UFRAG_PWD
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_CHANGE_UFRAG_PWD
:
...
@@ -252,12 +253,14 @@ void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Channel::R
...
@@ -252,12 +253,14 @@ void Worker::OnChannelRequest(Channel::UnixStreamSocket* /*channel*/, Channel::R
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_STOP_MIRRORING
:
case
Channel
:
:
Request
::
MethodId
::
TRANSPORT_STOP_MIRRORING
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_GET_STATS
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_UPDATE_RTP_PARAMETERS
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_PAUSE
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_PAUSE
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_RESUME
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_RESUME
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_SET_PREFERRED_PROFILE
:
case
Channel
:
:
Request
::
MethodId
::
PRODUCER_SET_PREFERRED_PROFILE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_CLOSE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_DUMP
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_GET_STATS
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_ENABLE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_ENABLE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_PAUSE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_PAUSE
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_RESUME
:
case
Channel
:
:
Request
::
MethodId
::
CONSUMER_RESUME
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论