Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
44a1248a
提交
44a1248a
authored
8月 29, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Step by step
上级
3e9be3da
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
158 行增加
和
241 行删除
+158
-241
Consumer.js
lib/Consumer.js
+3
-3
Peer.js
lib/Peer.js
+71
-153
Producer.js
lib/Producer.js
+3
-3
Room.js
lib/Room.js
+26
-46
Transport.js
lib/Transport.js
+4
-4
Worker.js
lib/Worker.js
+5
-4
Notifier.hpp
worker/include/Channel/Notifier.hpp
+1
-4
Consumer.hpp
worker/include/RTC/Consumer.hpp
+6
-1
Producer.hpp
worker/include/RTC/Producer.hpp
+6
-1
Router.hpp
worker/include/RTC/Router.hpp
+4
-3
Notifier.cpp
worker/src/Channel/Notifier.cpp
+1
-4
Consumer.cpp
worker/src/RTC/Consumer.cpp
+7
-2
Producer.cpp
worker/src/RTC/Producer.cpp
+11
-4
Router.cpp
worker/src/RTC/Router.cpp
+3
-3
Transport.cpp
worker/src/RTC/Transport.cpp
+6
-5
main.cpp
worker/src/main.cpp
+1
-1
没有找到文件。
lib/Consumer.js
浏览文件 @
44a1248a
...
@@ -18,7 +18,7 @@ class Consumer extends EnhancedEventEmitter
...
@@ -18,7 +18,7 @@ class Consumer extends EnhancedEventEmitter
this
.
_closed
=
false
;
this
.
_closed
=
false
;
// Internal data.
// Internal data.
// - .ro
om
Id
// - .ro
uter
Id
// - .peerId
// - .peerId
// - .consumerId
// - .consumerId
// - .transportId
// - .transportId
...
@@ -47,7 +47,7 @@ class Consumer extends EnhancedEventEmitter
...
@@ -47,7 +47,7 @@ class Consumer extends EnhancedEventEmitter
// @type {Boolean}
// @type {Boolean}
this
.
_sourcePaused
=
false
;
this
.
_sourcePaused
=
false
;
this
.
_handleNotifications
();
this
.
_handle
Worker
Notifications
();
}
}
get
id
()
get
id
()
...
@@ -380,7 +380,7 @@ class Consumer extends EnhancedEventEmitter
...
@@ -380,7 +380,7 @@ class Consumer extends EnhancedEventEmitter
this
.
safeEmit
(
'resume'
,
'remote'
,
appData
);
this
.
safeEmit
(
'resume'
,
'remote'
,
appData
);
}
}
_handleNotifications
()
_handle
Worker
Notifications
()
{
{
// Subscribe to notifications.
// Subscribe to notifications.
this
.
_channel
.
on
(
this
.
_internal
.
consumerId
,
(
event
)
=>
this
.
_channel
.
on
(
this
.
_internal
.
consumerId
,
(
event
)
=>
...
...
lib/Peer.js
浏览文件 @
44a1248a
...
@@ -6,7 +6,7 @@ const utils = require('./utils');
...
@@ -6,7 +6,7 @@ const utils = require('./utils');
const
errors
=
require
(
'./errors'
);
const
errors
=
require
(
'./errors'
);
const
Transport
=
require
(
'./Transport'
);
const
Transport
=
require
(
'./Transport'
);
const
Producer
=
require
(
'./Producer'
);
const
Producer
=
require
(
'./Producer'
);
const
Consumer
=
require
(
'./Consumer'
);
//
const Consumer = require('./Consumer');
const
KINDS
=
new
Set
([
'audio'
,
'video'
,
'depth'
]);
const
KINDS
=
new
Set
([
'audio'
,
'video'
,
'depth'
]);
...
@@ -24,8 +24,7 @@ class Peer extends EnhancedEventEmitter
...
@@ -24,8 +24,7 @@ class Peer extends EnhancedEventEmitter
this
.
_closed
=
false
;
this
.
_closed
=
false
;
// Internal data.
// Internal data.
// - .roomId
// - .routerId
// - .peerId
// - .peerName
// - .peerName
this
.
_internal
=
internal
;
this
.
_internal
=
internal
;
...
@@ -36,6 +35,7 @@ class Peer extends EnhancedEventEmitter
...
@@ -36,6 +35,7 @@ class Peer extends EnhancedEventEmitter
// Channel instance.
// Channel instance.
this
.
_channel
=
channel
;
this
.
_channel
=
channel
;
// TODO: Let's see.
// Store internal sandbox stuff.
// Store internal sandbox stuff.
// - .getProducerById()
// - .getProducerById()
this
.
_sandbox
=
sandbox
;
this
.
_sandbox
=
sandbox
;
...
@@ -43,9 +43,6 @@ class Peer extends EnhancedEventEmitter
...
@@ -43,9 +43,6 @@ class Peer extends EnhancedEventEmitter
// App data.
// App data.
this
.
_appData
=
undefined
;
this
.
_appData
=
undefined
;
// Whether we are joined so can emit '@notify' events.
this
.
_joined
=
false
;
// Map of Transports indexed by id.
// Map of Transports indexed by id.
this
.
_transports
=
new
Map
();
this
.
_transports
=
new
Map
();
...
@@ -54,13 +51,6 @@ class Peer extends EnhancedEventEmitter
...
@@ -54,13 +51,6 @@ class Peer extends EnhancedEventEmitter
// Map of Consumers indexed by id.
// Map of Consumers indexed by id.
this
.
_consumers
=
new
Map
();
this
.
_consumers
=
new
Map
();
this
.
_handleNotifications
();
}
get
id
()
{
return
this
.
_internal
.
peerId
;
}
}
get
closed
()
get
closed
()
...
@@ -83,11 +73,6 @@ class Peer extends EnhancedEventEmitter
...
@@ -83,11 +73,6 @@ class Peer extends EnhancedEventEmitter
this
.
_appData
=
appData
;
this
.
_appData
=
appData
;
}
}
set
joined
(
flag
)
{
this
.
_joined
=
Boolean
(
joined
);
}
get
rtpCapabilities
()
get
rtpCapabilities
()
{
{
return
this
.
_data
.
rtpCapabilities
;
return
this
.
_data
.
rtpCapabilities
;
...
@@ -147,26 +132,24 @@ class Peer extends EnhancedEventEmitter
...
@@ -147,26 +132,24 @@ class Peer extends EnhancedEventEmitter
// Close all the Producers.
// Close all the Producers.
for
(
const
producer
of
this
.
_producers
.
values
())
for
(
const
producer
of
this
.
_producers
.
values
())
{
{
producer
.
close
(
undefined
,
false
);
producer
.
close
(
undefined
,
notifyChannel
);
}
}
// Close all the Consumers.
// Close all the Consumers.
for
(
const
consumer
of
this
.
_consumers
.
values
())
for
(
const
consumer
of
this
.
_consumers
.
values
())
{
{
consumer
.
close
();
consumer
.
close
(
undefined
,
notifyChannel
);
}
}
// Close all the Transports.
// Close all the Transports.
for
(
const
transport
of
this
.
_transports
.
values
())
for
(
const
transport
of
this
.
_transports
.
values
())
{
{
transport
.
close
(
undefined
,
false
);
transport
.
close
(
undefined
,
notifyChannel
);
}
}
this
.
_destroy
(
notifyChannel
);
}
}
/**
/**
* The remote Peer
was closed
.
* The remote Peer
left the Room
.
* Invoked via remote notification.
* Invoked via remote notification.
*
*
* @private
* @private
...
@@ -188,7 +171,7 @@ class Peer extends EnhancedEventEmitter
...
@@ -188,7 +171,7 @@ class Peer extends EnhancedEventEmitter
// Close all the Producers.
// Close all the Producers.
for
(
const
producer
of
this
.
_producers
.
values
())
for
(
const
producer
of
this
.
_producers
.
values
())
{
{
producer
.
remoteClose
(
undefined
,
false
);
producer
.
remoteClose
();
}
}
// Close all the Consumers.
// Close all the Consumers.
...
@@ -200,32 +183,7 @@ class Peer extends EnhancedEventEmitter
...
@@ -200,32 +183,7 @@ class Peer extends EnhancedEventEmitter
// Close all the Transports.
// Close all the Transports.
for
(
const
transport
of
this
.
_transports
.
values
())
for
(
const
transport
of
this
.
_transports
.
values
())
{
{
transport
.
remoteClose
(
undefined
,
false
);
transport
.
remoteClose
();
}
this
.
_destroy
();
}
/**
* Destroy the Peer.
*/
_destroy
(
notifyChannel
=
true
)
{
// Remove notification subscriptions.
this
.
_channel
.
removeAllListeners
(
this
.
_internal
.
peerId
);
if
(
notifyChannel
)
{
// Send Channel request.
this
.
_channel
.
request
(
'peer.close'
,
this
.
_internal
)
.
then
(()
=>
{
logger
.
debug
(
'"peer.close" request succeeded'
);
})
.
catch
((
error
)
=>
{
logger
.
error
(
'"peer.close" request failed: %s'
,
String
(
error
));
});
}
}
}
}
...
@@ -277,16 +235,58 @@ class Peer extends EnhancedEventEmitter
...
@@ -277,16 +235,58 @@ class Peer extends EnhancedEventEmitter
if
(
this
.
_closed
)
if
(
this
.
_closed
)
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Peer closed'
));
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Peer closed'
));
return
this
.
_channel
.
request
(
'peer.dump'
,
this
.
_internal
)
const
peerData
=
{
peerName
:
this
.
name
,
transports
:
[],
producers
:
[],
consumers
:
[]
};
const
promises
=
[];
for
(
const
transport
of
this
.
_transports
.
values
())
{
const
promise
=
transport
.
dump
()
.
then
((
data
)
=>
{
peerData
.
transports
.
push
(
data
);
});
promises
.
push
(
promise
);
}
for
(
const
producer
of
this
.
_producers
.
values
())
{
const
promise
=
producer
.
dump
()
.
then
((
data
)
=>
{
peerData
.
producers
.
push
(
data
);
});
promises
.
push
(
promise
);
}
for
(
const
consumer
of
this
.
_consumers
.
values
())
{
const
promise
=
consumer
.
dump
()
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
logger
.
debug
(
'"peer.dump" request succeeded'
);
peerData
.
consumers
.
push
(
data
);
});
return
data
;
promises
.
push
(
promise
);
}
return
Promise
.
all
(
promises
)
.
then
(()
=>
{
logger
.
debug
(
'dump() | succeeded'
);
return
peerData
;
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'
"peer.dump" request
failed: %s'
,
String
(
error
));
logger
.
error
(
'
dump() |
failed: %s'
,
String
(
error
));
throw
error
;
throw
error
;
});
});
...
@@ -316,11 +316,9 @@ class Peer extends EnhancedEventEmitter
...
@@ -316,11 +316,9 @@ class Peer extends EnhancedEventEmitter
{
{
const
{
id
,
options
,
dtlsParameters
,
appData
}
=
request
;
const
{
id
,
options
,
dtlsParameters
,
appData
}
=
request
;
return
this
.
_createTransport
(
id
,
options
)
return
this
.
_createTransport
(
id
,
options
,
appData
)
.
then
((
transport
)
=>
.
then
((
transport
)
=>
{
{
transport
.
appData
=
appData
;
// If no client's DTLS parameters are given, we are done.
// If no client's DTLS parameters are given, we are done.
if
(
!
dtlsParameters
)
if
(
!
dtlsParameters
)
return
transport
;
return
transport
;
...
@@ -383,11 +381,9 @@ class Peer extends EnhancedEventEmitter
...
@@ -383,11 +381,9 @@ class Peer extends EnhancedEventEmitter
const
rtpMapping
=
const
rtpMapping
=
this
.
_sandbox
.
getProducerRtpParametersMapping
(
rtpParameters
);
this
.
_sandbox
.
getProducerRtpParametersMapping
(
rtpParameters
);
return
this
.
_createProducer
(
id
,
kind
,
transportId
)
return
this
.
_createProducer
(
id
,
kind
,
transportId
,
appData
)
.
then
((
producer
)
=>
.
then
((
producer
)
=>
{
{
producer
.
appData
=
appData
;
if
(
paused
)
if
(
paused
)
producer
.
remotePause
();
producer
.
remotePause
();
...
@@ -547,25 +543,26 @@ class Peer extends EnhancedEventEmitter
...
@@ -547,25 +543,26 @@ class Peer extends EnhancedEventEmitter
this
.
safeEmit
(
'notify'
,
notification
);
this
.
safeEmit
(
'notify'
,
notification
);
}
}
_createTransport
(
id
,
options
)
_createTransport
(
id
,
options
,
appData
)
{
{
logger
.
debug
(
'_createTransport() [id:%s]'
,
id
);
logger
.
debug
(
'_createTransport() [id:%s]'
,
id
);
const
internal
=
const
internal
=
{
{
roomId
:
this
.
_internal
.
roomId
,
routerId
:
this
.
_internal
.
routerId
,
peerId
:
this
.
_internal
.
peerId
,
transportId
:
id
||
utils
.
randomNumber
()
transportId
:
id
||
utils
.
randomNumber
()
};
};
return
this
.
_channel
.
request
(
'
pe
er.createTransport'
,
internal
,
options
)
return
this
.
_channel
.
request
(
'
rout
er.createTransport'
,
internal
,
options
)
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
logger
.
debug
(
'"
pe
er.createTransport" request succeeded'
);
logger
.
debug
(
'"
rout
er.createTransport" request succeeded'
);
// Create a Transport.
// Create a Transport.
const
transport
=
new
Transport
(
internal
,
data
,
this
.
_channel
);
const
transport
=
new
Transport
(
internal
,
data
,
this
.
_channel
);
transport
.
appData
=
appData
;
// Store the Transport and remove it when closed.
// Store the Transport and remove it when closed.
this
.
_transports
.
set
(
transport
.
id
,
transport
);
this
.
_transports
.
set
(
transport
.
id
,
transport
);
transport
.
on
(
'@close'
,
()
=>
this
.
_transports
.
delete
(
transport
.
id
));
transport
.
on
(
'@close'
,
()
=>
this
.
_transports
.
delete
(
transport
.
id
));
...
@@ -581,13 +578,13 @@ class Peer extends EnhancedEventEmitter
...
@@ -581,13 +578,13 @@ class Peer extends EnhancedEventEmitter
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'"
pe
er.createTransport" request failed: %s'
,
String
(
error
));
logger
.
error
(
'"
rout
er.createTransport" request failed: %s'
,
String
(
error
));
throw
error
;
throw
error
;
});
});
}
}
_createProducer
(
id
,
kind
,
transportId
)
_createProducer
(
id
,
kind
,
transportId
,
appData
)
{
{
logger
.
debug
(
'_createProducer() [id:%s, kind:%s]'
,
id
,
kind
);
logger
.
debug
(
'_createProducer() [id:%s, kind:%s]'
,
id
,
kind
);
...
@@ -603,8 +600,7 @@ class Peer extends EnhancedEventEmitter
...
@@ -603,8 +600,7 @@ class Peer extends EnhancedEventEmitter
const
internal
=
const
internal
=
{
{
roomId
:
this
.
_internal
.
roomId
,
routerId
:
this
.
_internal
.
routerId
,
peerId
:
this
.
_internal
.
peerId
,
producerId
:
id
||
utils
.
randomNumber
(),
producerId
:
id
||
utils
.
randomNumber
(),
transportId
:
transport
.
id
transportId
:
transport
.
id
};
};
...
@@ -621,14 +617,16 @@ class Peer extends EnhancedEventEmitter
...
@@ -621,14 +617,16 @@ class Peer extends EnhancedEventEmitter
kind
kind
};
};
return
this
.
_channel
.
request
(
'
pe
er.createProducer'
,
internal
,
options
)
return
this
.
_channel
.
request
(
'
rout
er.createProducer'
,
internal
,
options
)
.
then
(()
=>
.
then
(()
=>
{
{
logger
.
debug
(
'"
pe
er.createProducer" request succeeded'
);
logger
.
debug
(
'"
rout
er.createProducer" request succeeded'
);
// Create a Producer instance.
// Create a Producer instance.
const
producer
=
new
Producer
(
internal
,
data
,
this
.
_channel
);
const
producer
=
new
Producer
(
internal
,
data
,
this
.
_channel
);
producer
.
appData
=
appData
;
// Store the Producer and remove it when closed.
// Store the Producer and remove it when closed.
this
.
_producers
.
set
(
producer
.
id
,
producer
);
this
.
_producers
.
set
(
producer
.
id
,
producer
);
producer
.
on
(
'@close'
,
()
=>
this
.
_producers
.
delete
(
producer
.
id
));
producer
.
on
(
'@close'
,
()
=>
this
.
_producers
.
delete
(
producer
.
id
));
...
@@ -652,91 +650,11 @@ class Peer extends EnhancedEventEmitter
...
@@ -652,91 +650,11 @@ class Peer extends EnhancedEventEmitter
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'"
pe
er.createProducer" request failed: %s'
,
String
(
error
));
logger
.
error
(
'"
rout
er.createProducer" request failed: %s'
,
String
(
error
));
throw
error
;
throw
error
;
});
});
}
}
_handleNotifications
()
{
// Subscribe to notifications.
this
.
_channel
.
on
(
this
.
_internal
.
peerId
,
(
event
,
data
)
=>
{
switch
(
event
)
{
case
'close'
:
{
this
.
close
(
undefined
,
false
);
break
;
}
// TODO: yes? or get it from data.peerName in 'newconsumer' and retreive
// peers via JS? Then what about `peerClosed`?
case
'newpeer'
:
{
// TODO
break
;
}
case
'newconsumer'
:
{
// TODO
console
.
warn
(
'----------------- newconsumer | peer.consumers:%s'
,
this
.
_consumers
.
size
+
1
);
// TODO
const
source
=
this
.
_sandbox
.
getProducerById
(
data
.
sourceId
);
const
consumerInternal
=
{
roomId
:
this
.
_internal
.
roomId
,
peerId
:
this
.
_internal
.
peerId
,
consumerId
:
data
.
consumerId
,
transportId
:
undefined
};
// TODO
const
consumerData
=
{
kind
:
data
.
kind
,
peer
:
this
,
rtpParameters
:
data
.
rtpParameters
,
source
:
source
};
// Create a Consumer instance.
const
consumer
=
new
Consumer
(
consumerInternal
,
consumerData
,
this
.
_channel
);
// Store the Consumer instance and remove it when closed.
this
.
_consumers
.
set
(
consumer
.
id
,
consumer
);
consumer
.
on
(
'@close'
,
()
=>
this
.
_consumers
.
delete
(
consumer
.
id
));
// TODO: Get the Consumer Peer?
if
(
this
.
_joined
)
{
// TODO: Let's see.
// TODO: appData? of the associated Producer/source?
// const foo = consumer.toJson();
const
foo
=
{
id
:
consumer
.
id
,
kind
:
consumer
.
kind
};
// Send a notification.
this
.
_sendNotification
(
'newConsumer'
,
foo
);
}
this
.
safeEmit
(
'newconsumer'
,
consumer
);
break
;
}
default
:
logger
.
error
(
'ignoring unknown event "%s"'
,
event
);
}
});
}
}
}
module
.
exports
=
Peer
;
module
.
exports
=
Peer
;
lib/Producer.js
浏览文件 @
44a1248a
...
@@ -18,7 +18,7 @@ class Producer extends EnhancedEventEmitter
...
@@ -18,7 +18,7 @@ class Producer extends EnhancedEventEmitter
this
.
_closed
=
false
;
this
.
_closed
=
false
;
// Internal data.
// Internal data.
// - .ro
om
Id
// - .ro
uter
Id
// - .peerId
// - .peerId
// - .producerId
// - .producerId
// - .transportId
// - .transportId
...
@@ -42,7 +42,7 @@ class Producer extends EnhancedEventEmitter
...
@@ -42,7 +42,7 @@ class Producer extends EnhancedEventEmitter
// @type {Boolean}
// @type {Boolean}
this
.
_remotelyPaused
=
false
;
this
.
_remotelyPaused
=
false
;
this
.
_handleNotifications
();
this
.
_handle
Worker
Notifications
();
}
}
get
id
()
get
id
()
...
@@ -392,7 +392,7 @@ class Producer extends EnhancedEventEmitter
...
@@ -392,7 +392,7 @@ class Producer extends EnhancedEventEmitter
this
.
safeEmit
(
'resume'
,
'remote'
,
appData
);
this
.
safeEmit
(
'resume'
,
'remote'
,
appData
);
}
}
_handleNotifications
()
_handle
Worker
Notifications
()
{
{
// Subscribe to notifications.
// Subscribe to notifications.
this
.
_channel
.
on
(
this
.
_internal
.
producerId
,
(
event
,
data
,
buffer
)
=>
this
.
_channel
.
on
(
this
.
_internal
.
producerId
,
(
event
,
data
,
buffer
)
=>
...
...
lib/Room.js
浏览文件 @
44a1248a
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
const
Logger
=
require
(
'./Logger'
);
const
Logger
=
require
(
'./Logger'
);
const
EnhancedEventEmitter
=
require
(
'./EnhancedEventEmitter'
);
const
EnhancedEventEmitter
=
require
(
'./EnhancedEventEmitter'
);
const
errors
=
require
(
'./errors'
);
const
errors
=
require
(
'./errors'
);
const
utils
=
require
(
'./utils'
);
const
ortc
=
require
(
'./ortc'
);
const
ortc
=
require
(
'./ortc'
);
const
Peer
=
require
(
'./Peer'
);
const
Peer
=
require
(
'./Peer'
);
...
@@ -21,7 +20,7 @@ class Room extends EnhancedEventEmitter
...
@@ -21,7 +20,7 @@ class Room extends EnhancedEventEmitter
this
.
_closed
=
false
;
this
.
_closed
=
false
;
// Internal data.
// Internal data.
// - .ro
om
Id
// - .ro
uter
Id
this
.
_internal
=
internal
;
this
.
_internal
=
internal
;
// Room data.
// Room data.
...
@@ -38,12 +37,12 @@ class Room extends EnhancedEventEmitter
...
@@ -38,12 +37,12 @@ class Room extends EnhancedEventEmitter
// Map of Producer instances indexed by `producerId`.
// Map of Producer instances indexed by `producerId`.
this
.
_producers
=
new
Map
();
this
.
_producers
=
new
Map
();
this
.
_handleNotifications
();
this
.
_handle
Worker
Notifications
();
}
}
get
id
()
get
id
()
{
{
return
this
.
_internal
.
ro
om
Id
;
return
this
.
_internal
.
ro
uter
Id
;
}
}
get
closed
()
get
closed
()
...
@@ -85,7 +84,7 @@ class Room extends EnhancedEventEmitter
...
@@ -85,7 +84,7 @@ class Room extends EnhancedEventEmitter
this
.
safeEmit
(
'close'
,
appData
);
this
.
safeEmit
(
'close'
,
appData
);
// Remove notification subscriptions.
// Remove notification subscriptions.
this
.
_channel
.
removeAllListeners
(
this
.
_internal
.
ro
om
Id
);
this
.
_channel
.
removeAllListeners
(
this
.
_internal
.
ro
uter
Id
);
// Close every Peer.
// Close every Peer.
for
(
const
peer
of
this
.
_peers
.
values
())
for
(
const
peer
of
this
.
_peers
.
values
())
...
@@ -96,14 +95,14 @@ class Room extends EnhancedEventEmitter
...
@@ -96,14 +95,14 @@ class Room extends EnhancedEventEmitter
if
(
notifyChannel
)
if
(
notifyChannel
)
{
{
// Send Channel request.
// Send Channel request.
this
.
_channel
.
request
(
'ro
om
.close'
,
this
.
_internal
)
this
.
_channel
.
request
(
'ro
uter
.close'
,
this
.
_internal
)
.
then
(()
=>
.
then
(()
=>
{
{
logger
.
debug
(
'"ro
om
.close" request succeeded'
);
logger
.
debug
(
'"ro
uter
.close" request succeeded'
);
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'"ro
om
.close" request failed: %s'
,
String
(
error
));
logger
.
error
(
'"ro
uter
.close" request failed: %s'
,
String
(
error
));
});
});
}
}
}
}
...
@@ -120,16 +119,16 @@ class Room extends EnhancedEventEmitter
...
@@ -120,16 +119,16 @@ class Room extends EnhancedEventEmitter
if
(
this
.
_closed
)
if
(
this
.
_closed
)
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Room closed'
));
return
Promise
.
reject
(
new
errors
.
InvalidStateError
(
'Room closed'
));
return
this
.
_channel
.
request
(
'ro
om
.dump'
,
this
.
_internal
)
return
this
.
_channel
.
request
(
'ro
uter
.dump'
,
this
.
_internal
)
.
then
((
data
)
=>
.
then
((
data
)
=>
{
{
logger
.
debug
(
'"ro
om
.dump" request succeeded'
);
logger
.
debug
(
'"ro
uter
.dump" request succeeded'
);
return
data
;
return
data
;
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'"ro
om
.dump" request failed: %s'
,
String
(
error
));
logger
.
error
(
'"ro
uter
.dump" request failed: %s'
,
String
(
error
));
throw
error
;
throw
error
;
});
});
...
@@ -188,6 +187,7 @@ class Room extends EnhancedEventEmitter
...
@@ -188,6 +187,7 @@ class Room extends EnhancedEventEmitter
ortc
.
assertCapabilitiesSubset
(
ortc
.
assertCapabilitiesSubset
(
rtpCapabilities
,
this
.
rtpCapabilities
);
rtpCapabilities
,
this
.
rtpCapabilities
);
// eslint-disable-next-line no-unused-vars
const
peer
=
this
.
_createPeer
(
peerName
,
rtpCapabilities
,
appData
);
const
peer
=
this
.
_createPeer
(
peerName
,
rtpCapabilities
,
appData
);
const
response
=
const
response
=
...
@@ -215,14 +215,13 @@ class Room extends EnhancedEventEmitter
...
@@ -215,14 +215,13 @@ class Room extends EnhancedEventEmitter
logger
.
debug
(
'_createPeer() [peerName:"%s]'
,
peerName
);
logger
.
debug
(
'_createPeer() [peerName:"%s]'
,
peerName
);
if
(
!
peerName
||
typeof
peerName
!==
'string'
)
if
(
!
peerName
||
typeof
peerName
!==
'string'
)
return
Promise
.
reject
(
new
TypeError
(
'peerName must be a string'
)
);
throw
new
TypeError
(
'peerName must be a string'
);
else
if
(
this
.
_peers
.
has
(
peerName
))
else
if
(
this
.
_peers
.
has
(
peerName
))
return
Promise
.
reject
(
new
Error
(
`duplicated Peer [peerName:"
${
peerName
}
"]`
)
);
throw
new
Error
(
`duplicated Peer [peerName:"
${
peerName
}
"]`
);
const
internal
=
const
internal
=
{
{
roomId
:
this
.
_internal
.
roomId
,
routerId
:
this
.
_internal
.
routerId
,
peerId
:
utils
.
randomNumber
(),
peerName
:
peerName
peerName
:
peerName
};
};
...
@@ -233,6 +232,7 @@ class Room extends EnhancedEventEmitter
...
@@ -233,6 +232,7 @@ class Room extends EnhancedEventEmitter
const
sandbox
=
const
sandbox
=
{
{
// TODO: Let's see.
getProducerById
:
(
producerId
)
=>
getProducerById
:
(
producerId
)
=>
{
{
return
this
.
_producers
.
get
(
producerId
);
return
this
.
_producers
.
get
(
producerId
);
...
@@ -255,6 +255,7 @@ class Room extends EnhancedEventEmitter
...
@@ -255,6 +255,7 @@ class Room extends EnhancedEventEmitter
this
.
_peers
.
set
(
peer
.
name
,
peer
);
this
.
_peers
.
set
(
peer
.
name
,
peer
);
peer
.
on
(
'@close'
,
()
=>
this
.
_peers
.
delete
(
peer
.
name
));
peer
.
on
(
'@close'
,
()
=>
this
.
_peers
.
delete
(
peer
.
name
));
// TODO: Let's see.
// Listen for new Producers so we can associate new Consumers.
// Listen for new Producers so we can associate new Consumers.
peer
.
on
(
'@newproducer'
,
(
producer
)
=>
peer
.
on
(
'@newproducer'
,
(
producer
)
=>
{
{
...
@@ -263,42 +264,21 @@ class Room extends EnhancedEventEmitter
...
@@ -263,42 +264,21 @@ class Room extends EnhancedEventEmitter
producer
.
on
(
'@close'
,
()
=>
this
.
_producers
.
delete
(
producer
.
id
));
producer
.
on
(
'@close'
,
()
=>
this
.
_producers
.
delete
(
producer
.
id
));
});
});
this
.
_channel
.
request
(
'room.createPeer'
,
internal
)
.
then
(()
=>
{
logger
.
debug
(
'"room.createPeer" request succeeded'
);
peer
.
joined
=
true
;
})
.
catch
((
error
)
=>
{
logger
.
error
(
'"room.createPeer" request failed: %s'
,
String
(
error
));
peer
.
close
();
});
this
.
safeEmit
(
'newpeer'
,
peer
);
this
.
safeEmit
(
'newpeer'
,
peer
);
return
peer
;
return
peer
;
}
}
_handleNotifications
()
_handle
Worker
Notifications
()
{
{
// Subscribe to notifications.
// Subscribe to notifications.
this
.
_channel
.
on
(
this
.
_internal
.
ro
om
Id
,
(
event
,
data
)
=>
this
.
_channel
.
on
(
this
.
_internal
.
ro
uter
Id
,
(
event
,
data
)
=>
{
{
switch
(
event
)
switch
(
event
)
{
{
case
'close'
:
{
this
.
close
(
undefined
,
false
);
break
;
}
case
'audiolevels'
:
case
'audiolevels'
:
{
{
const
entries
=
data
.
entries
;
const
{
entries
}
=
data
;
const
entries2
=
[];
const
entries2
=
[];
for
(
const
entry
of
entries
)
for
(
const
entry
of
entries
)
...
@@ -310,7 +290,7 @@ class Room extends EnhancedEventEmitter
...
@@ -310,7 +290,7 @@ class Room extends EnhancedEventEmitter
if
(
!
producer
)
if
(
!
producer
)
continue
;
continue
;
const
peer
=
producer
.
pe
er
;
const
{
peer
}
=
produc
er
;
entries2
.
push
({
peer
,
producer
,
audioLevel
});
entries2
.
push
({
peer
,
producer
,
audioLevel
});
}
}
...
@@ -348,15 +328,15 @@ class Room extends EnhancedEventEmitter
...
@@ -348,15 +328,15 @@ class Room extends EnhancedEventEmitter
// Send Channel request.
// Send Channel request.
this
.
_channel
.
request
(
this
.
_channel
.
request
(
'ro
om
.setAudioLevelsEvent'
,
this
.
_internal
,
{
enabled
:
true
})
'ro
uter
.setAudioLevelsEvent'
,
this
.
_internal
,
{
enabled
:
true
})
.
then
(()
=>
.
then
(()
=>
{
{
logger
.
debug
(
'"ro
om
.setAudioLevelsEvent" request succeeded'
);
logger
.
debug
(
'"ro
uter
.setAudioLevelsEvent" request succeeded'
);
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
logger
.
error
(
'"ro
om
.setAudioLevelsEvent" request failed: %s'
,
String
(
error
));
'"ro
uter
.setAudioLevelsEvent" request failed: %s'
,
String
(
error
));
});
});
break
;
break
;
...
@@ -377,15 +357,15 @@ class Room extends EnhancedEventEmitter
...
@@ -377,15 +357,15 @@ class Room extends EnhancedEventEmitter
// Send Channel request.
// Send Channel request.
this
.
_channel
.
request
(
this
.
_channel
.
request
(
'ro
om
.setAudioLevelsEvent'
,
this
.
_internal
,
{
enabled
:
false
})
'ro
uter
.setAudioLevelsEvent'
,
this
.
_internal
,
{
enabled
:
false
})
.
then
(()
=>
.
then
(()
=>
{
{
logger
.
debug
(
'"ro
om
.setAudioLevelsEvent" request succeeded'
);
logger
.
debug
(
'"ro
uter
.setAudioLevelsEvent" request succeeded'
);
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
logger
.
error
(
'"ro
om
.setAudioLevelsEvent" request failed: %s'
,
String
(
error
));
'"ro
uter
.setAudioLevelsEvent" request failed: %s'
,
String
(
error
));
});
});
break
;
break
;
...
...
lib/Transport.js
浏览文件 @
44a1248a
...
@@ -18,8 +18,7 @@ class Transport extends EnhancedEventEmitter
...
@@ -18,8 +18,7 @@ class Transport extends EnhancedEventEmitter
this
.
_closed
=
false
;
this
.
_closed
=
false
;
// Internal data.
// Internal data.
// - .roomId
// - .routerId
// - .peerId
// - .transportId
// - .transportId
this
.
_internal
=
internal
;
this
.
_internal
=
internal
;
...
@@ -65,7 +64,7 @@ class Transport extends EnhancedEventEmitter
...
@@ -65,7 +64,7 @@ class Transport extends EnhancedEventEmitter
// App data.
// App data.
this
.
_appData
=
undefined
;
this
.
_appData
=
undefined
;
this
.
_handleNotifications
();
this
.
_handle
Worker
Notifications
();
}
}
get
id
()
get
id
()
...
@@ -330,13 +329,14 @@ class Transport extends EnhancedEventEmitter
...
@@ -330,13 +329,14 @@ class Transport extends EnhancedEventEmitter
});
});
}
}
_handleNotifications
()
_handle
Worker
Notifications
()
{
{
// Subscribe to notifications.
// Subscribe to notifications.
this
.
_channel
.
on
(
this
.
_internal
.
transportId
,
(
event
,
data
)
=>
this
.
_channel
.
on
(
this
.
_internal
.
transportId
,
(
event
,
data
)
=>
{
{
switch
(
event
)
switch
(
event
)
{
{
// TODO: may be
case
'close'
:
case
'close'
:
{
{
this
.
close
(
undefined
,
false
);
this
.
close
(
undefined
,
false
);
...
...
lib/Worker.js
浏览文件 @
44a1248a
...
@@ -187,22 +187,23 @@ class Worker extends EventEmitter
...
@@ -187,22 +187,23 @@ class Worker extends EventEmitter
const
internal
=
const
internal
=
{
{
ro
om
Id
:
utils
.
randomNumber
()
ro
uter
Id
:
utils
.
randomNumber
()
};
};
const
room
=
new
Room
(
internal
,
data
,
this
.
_channel
);
const
room
=
new
Room
(
internal
,
data
,
this
.
_channel
);
// Store the Room instance and remove it when closed.
// Store the Room instance and remove it when closed.
this
.
_rooms
.
add
(
room
);
this
.
_rooms
.
add
(
room
);
room
.
on
(
'@close'
,
()
=>
this
.
_rooms
.
delete
(
room
));
room
.
on
(
'@close'
,
()
=>
this
.
_rooms
.
delete
(
room
));
this
.
_channel
.
request
(
'worker.createRo
om
'
,
internal
)
this
.
_channel
.
request
(
'worker.createRo
uter
'
,
internal
)
.
then
(()
=>
.
then
(()
=>
{
{
logger
.
debug
(
'"worker.createRo
om
" request succeeded'
);
logger
.
debug
(
'"worker.createRo
uter
" request succeeded'
);
})
})
.
catch
((
error
)
=>
.
catch
((
error
)
=>
{
{
logger
.
error
(
'"worker.createRo
om
" request failed: %s'
,
String
(
error
));
logger
.
error
(
'"worker.createRo
uter
" request failed: %s'
,
String
(
error
));
room
.
close
(
undefined
,
false
);
room
.
close
(
undefined
,
false
);
});
});
...
...
worker/include/Channel/Notifier.hpp
浏览文件 @
44a1248a
...
@@ -16,10 +16,7 @@ namespace Channel
...
@@ -16,10 +16,7 @@ namespace Channel
void
Emit
(
uint32_t
targetId
,
const
std
::
string
&
event
);
void
Emit
(
uint32_t
targetId
,
const
std
::
string
&
event
);
void
Emit
(
uint32_t
targetId
,
const
std
::
string
&
event
,
Json
::
Value
&
data
);
void
Emit
(
uint32_t
targetId
,
const
std
::
string
&
event
,
Json
::
Value
&
data
);
void
EmitWithBinary
(
void
EmitWithBinary
(
uint32_t
targetId
,
uint32_t
targetId
,
const
std
::
string
&
event
,
const
uint8_t
*
binaryData
,
size_t
binaryLen
);
const
std
::
string
&
event
,
const
uint8_t
*
binaryData
,
size_t
binaryLen
);
void
EmitWithBinary
(
void
EmitWithBinary
(
uint32_t
targetId
,
uint32_t
targetId
,
const
std
::
string
&
event
,
const
std
::
string
&
event
,
...
...
worker/include/RTC/Consumer.hpp
浏览文件 @
44a1248a
...
@@ -32,7 +32,12 @@ namespace RTC
...
@@ -32,7 +32,12 @@ namespace RTC
};
};
public
:
public
:
Consumer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
consumerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
);
Consumer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
consumerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
);
private
:
private
:
virtual
~
Consumer
();
virtual
~
Consumer
();
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
44a1248a
...
@@ -45,7 +45,12 @@ namespace RTC
...
@@ -45,7 +45,12 @@ namespace RTC
};
};
public
:
public
:
Producer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
producerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
);
Producer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
producerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
);
public
:
public
:
// Must be public because Router needs to call it.
// Must be public because Router needs to call it.
...
...
worker/include/RTC/Router.hpp
浏览文件 @
44a1248a
...
@@ -4,10 +4,10 @@
...
@@ -4,10 +4,10 @@
#include "common.hpp"
#include "common.hpp"
#include "Channel/Notifier.hpp"
#include "Channel/Notifier.hpp"
#include "Channel/Request.hpp"
#include "Channel/Request.hpp"
#include "RTC/Transport.hpp"
#include "RTC/Producer.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Producer.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/RtpPacket.hpp"
#include "RTC/Transport.hpp"
// TODO: Let's see.
// TODO: Let's see.
// #include "RTC/RTCP/Feedback.hpp"
// #include "RTC/RTCP/Feedback.hpp"
// #include "RTC/RTCP/ReceiverReport.hpp"
// #include "RTC/RTCP/ReceiverReport.hpp"
...
@@ -51,7 +51,8 @@ namespace RTC
...
@@ -51,7 +51,8 @@ namespace RTC
void
HandleRequest
(
Channel
::
Request
*
request
);
void
HandleRequest
(
Channel
::
Request
*
request
);
private
:
private
:
RTC
::
Transport
*
GetTransportFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
transportId
=
nullptr
)
const
;
RTC
::
Transport
*
GetTransportFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
transportId
=
nullptr
)
const
;
RTC
::
Producer
*
GetProducerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
producerId
=
nullptr
)
const
;
RTC
::
Producer
*
GetProducerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
producerId
=
nullptr
)
const
;
RTC
::
Consumer
*
GetConsumerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
consumerId
=
nullptr
)
const
;
RTC
::
Consumer
*
GetConsumerFromRequest
(
Channel
::
Request
*
request
,
uint32_t
*
consumerId
=
nullptr
)
const
;
...
...
worker/src/Channel/Notifier.cpp
浏览文件 @
44a1248a
...
@@ -46,10 +46,7 @@ namespace Channel
...
@@ -46,10 +46,7 @@ namespace Channel
}
}
void
Notifier
::
EmitWithBinary
(
void
Notifier
::
EmitWithBinary
(
uint32_t
targetId
,
uint32_t
targetId
,
const
std
::
string
&
event
,
const
uint8_t
*
binaryData
,
size_t
binaryLen
)
const
std
::
string
&
event
,
const
uint8_t
*
binaryData
,
size_t
binaryLen
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
44a1248a
...
@@ -18,8 +18,13 @@ namespace RTC
...
@@ -18,8 +18,13 @@ namespace RTC
/* Instance methods. */
/* Instance methods. */
Consumer
::
Consumer
(
Consumer
::
Consumer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
consumerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
)
Listener
*
listener
,
:
consumerId
(
consumerId
),
kind
(
kind
),
listener
(
listener
),
notifier
(
notifier
),
transport
(
transport
)
Channel
::
Notifier
*
notifier
,
uint32_t
consumerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
)
:
consumerId
(
consumerId
),
kind
(
kind
),
listener
(
listener
),
notifier
(
notifier
),
transport
(
transport
)
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/Producer.cpp
浏览文件 @
44a1248a
...
@@ -13,8 +13,13 @@ namespace RTC
...
@@ -13,8 +13,13 @@ namespace RTC
/* Instance methods. */
/* Instance methods. */
Producer
::
Producer
(
Producer
::
Producer
(
Listener
*
listener
,
Channel
::
Notifier
*
notifier
,
uint32_t
producerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
)
Listener
*
listener
,
:
producerId
(
producerId
),
kind
(
kind
),
listener
(
listener
),
notifier
(
notifier
),
transport
(
transport
)
Channel
::
Notifier
*
notifier
,
uint32_t
producerId
,
RTC
::
Media
::
Kind
kind
,
RTC
::
Transport
*
transport
)
:
producerId
(
producerId
),
kind
(
kind
),
listener
(
listener
),
notifier
(
notifier
),
transport
(
transport
)
{
{
MS_TRACE
();
MS_TRACE
();
...
@@ -151,6 +156,9 @@ namespace RTC
...
@@ -151,6 +156,9 @@ namespace RTC
// NOTE: This may throw.
// NOTE: This may throw.
CreateRtpMapping
(
request
->
data
[
JsonStringRtpMapping
]);
CreateRtpMapping
(
request
->
data
[
JsonStringRtpMapping
]);
// NOTE: This may throw.
this
->
transport
->
HandleProducer
(
this
);
}
}
catch
(
const
MediaSoupError
&
error
)
catch
(
const
MediaSoupError
&
error
)
{
{
...
@@ -298,8 +306,7 @@ namespace RTC
...
@@ -298,8 +306,7 @@ namespace RTC
// Emit "rtpraw" if enabled.
// Emit "rtpraw" if enabled.
if
(
this
->
rtpRawEventEnabled
)
if
(
this
->
rtpRawEventEnabled
)
{
{
this
->
notifier
->
EmitWithBinary
(
this
->
notifier
->
EmitWithBinary
(
this
->
producerId
,
"rtpraw"
,
packet
->
GetData
(),
packet
->
GetSize
());
this
->
producerId
,
"rtpraw"
,
packet
->
GetData
(),
packet
->
GetSize
());
}
}
// Emit "rtpobject" is enabled.
// Emit "rtpobject" is enabled.
...
...
worker/src/RTC/Router.cpp
浏览文件 @
44a1248a
...
@@ -535,7 +535,7 @@ namespace RTC
...
@@ -535,7 +535,7 @@ namespace RTC
if
(
transportId
!=
nullptr
)
if
(
transportId
!=
nullptr
)
*
transportId
=
jsonTransportId
.
asUInt
();
*
transportId
=
jsonTransportId
.
asUInt
();
auto
it
=
this
->
transports
.
find
(
*
transportId
);
auto
it
=
this
->
transports
.
find
(
jsonTransportId
.
asUInt
()
);
if
(
it
!=
this
->
transports
.
end
())
if
(
it
!=
this
->
transports
.
end
())
{
{
auto
*
transport
=
it
->
second
;
auto
*
transport
=
it
->
second
;
...
@@ -560,7 +560,7 @@ namespace RTC
...
@@ -560,7 +560,7 @@ namespace RTC
if
(
producerId
!=
nullptr
)
if
(
producerId
!=
nullptr
)
*
producerId
=
jsonProducerId
.
asUInt
();
*
producerId
=
jsonProducerId
.
asUInt
();
auto
it
=
this
->
producers
.
find
(
*
producerId
);
auto
it
=
this
->
producers
.
find
(
jsonProducerId
.
asUInt
()
);
if
(
it
!=
this
->
producers
.
end
())
if
(
it
!=
this
->
producers
.
end
())
{
{
auto
*
producer
=
it
->
second
;
auto
*
producer
=
it
->
second
;
...
@@ -585,7 +585,7 @@ namespace RTC
...
@@ -585,7 +585,7 @@ namespace RTC
if
(
consumerId
!=
nullptr
)
if
(
consumerId
!=
nullptr
)
*
consumerId
=
jsonConsumerId
.
asUInt
();
*
consumerId
=
jsonConsumerId
.
asUInt
();
auto
it
=
this
->
consumers
.
find
(
*
consumerId
);
auto
it
=
this
->
consumers
.
find
(
jsonConsumerId
.
asUInt
()
);
if
(
it
!=
this
->
consumers
.
end
())
if
(
it
!=
this
->
consumers
.
end
())
{
{
auto
*
consumer
=
it
->
second
;
auto
*
consumer
=
it
->
second
;
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
44a1248a
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
#include "MediaSoupError.hpp"
#include "MediaSoupError.hpp"
#include "Settings.hpp"
#include "Settings.hpp"
#include "Utils.hpp"
#include "Utils.hpp"
#include "RTC/Producer.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Consumer.hpp"
#include "RTC/Producer.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp"
#include <cmath> // std::pow()
#include <cmath> // std::pow()
#include <iterator> // std::ostream_iterator
#include <iterator> // std::ostream_iterator
...
@@ -599,17 +599,18 @@ namespace RTC
...
@@ -599,17 +599,18 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// NOTE: This may throw.
// TODO: add to the set.
this
->
rtpListener
.
AddProducer
(
producer
);
// TODO: add to the map
// If it has RTP parameters pass it to the RTP listener.
if
(
producer
->
GetParameters
())
this
->
rtpListener
.
AddProducer
(
producer
);
}
}
void
Transport
::
HandleConsumer
(
RTC
::
Consumer
*
consumer
)
void
Transport
::
HandleConsumer
(
RTC
::
Consumer
*
consumer
)
{
{
MS_TRACE
();
MS_TRACE
();
// TODO
// TODO
: add to the set.
}
}
void
Transport
::
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
void
Transport
::
SendRtpPacket
(
RTC
::
RtpPacket
*
packet
)
...
...
worker/src/main.cpp
浏览文件 @
44a1248a
...
@@ -6,10 +6,10 @@
...
@@ -6,10 +6,10 @@
#include "DepLibUV.hpp"
#include "DepLibUV.hpp"
#include "DepOpenSSL.hpp"
#include "DepOpenSSL.hpp"
#include "Logger.hpp"
#include "Logger.hpp"
#include "Worker.hpp"
#include "MediaSoupError.hpp"
#include "MediaSoupError.hpp"
#include "Settings.hpp"
#include "Settings.hpp"
#include "Utils.hpp"
#include "Utils.hpp"
#include "Worker.hpp"
#include "Channel/UnixStreamSocket.hpp"
#include "Channel/UnixStreamSocket.hpp"
#include "RTC/DtlsTransport.hpp"
#include "RTC/DtlsTransport.hpp"
#include "RTC/SrtpSession.hpp"
#include "RTC/SrtpSession.hpp"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论