Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
15204a33
提交
15204a33
authored
2月 20, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove useless C++ RtpListener class.
上级
e5ee62f1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
0 行增加
和
165 行删除
+0
-165
RtpListener.h
worker/include/RTC/RtpListener.h
+0
-35
RtpListener.cpp
worker/src/RTC/RtpListener.cpp
+0
-130
没有找到文件。
worker/include/RTC/RtpListener.h
deleted
100644 → 0
浏览文件 @
e5ee62f1
#ifndef MS_RTC_RTP_LISTENER_H
#define MS_RTC_RTP_LISTENER_H
#include "common.h"
#include "RTC/RtpReceiver.h"
#include "RTC/RtpParameters.h"
#include "RTC/RtpPacket.h"
#include <unordered_map>
#include <json/json.h>
namespace
RTC
{
class
RtpListener
{
public
:
RtpListener
();
~
RtpListener
();
Json
::
Value
toJson
();
void
AddRtpReceiver
(
RTC
::
RtpReceiver
*
rtpReceiver
,
RTC
::
RtpParameters
*
rtpParameters
);
void
RemoveRtpReceiver
(
RTC
::
RtpReceiver
*
rtpReceiver
);
RTC
::
RtpReceiver
*
GetRtpReceiver
(
RTC
::
RtpPacket
*
packet
);
private
:
// Others.
// - Table of SSRC / RtpReceiver pairs.
std
::
unordered_map
<
uint32_t
,
RTC
::
RtpReceiver
*>
ssrcTable
;
// - Table of MID RTP header extension / RtpReceiver pairs.
// std::unordered_map<uint16_t, RTC::RtpReceiver*> midTable;
// - Table of RTP payload type / RtpReceiver pairs.
std
::
unordered_map
<
uint8_t
,
RTC
::
RtpReceiver
*>
ptTable
;
};
}
#endif
worker/src/RTC/RtpListener.cpp
deleted
100644 → 0
浏览文件 @
e5ee62f1
#define MS_CLASS "RTC::RtpListener"
#include "RTC/RtpListener.h"
#include "Logger.h"
#include <string>
namespace
RTC
{
/* Instance methods. */
RtpListener
::
RtpListener
()
{
MS_TRACE
();
}
RtpListener
::~
RtpListener
()
{
MS_TRACE
();
}
Json
::
Value
RtpListener
::
toJson
()
{
MS_TRACE
();
static
const
Json
::
StaticString
k_ssrcTable
(
"ssrcTable"
);
// static const Json::StaticString k_midTable("midTable"); // TODO
static
const
Json
::
StaticString
k_ptTable
(
"ptTable"
);
Json
::
Value
json
(
Json
::
objectValue
);
// Add `ssrcTable`.
Json
::
Value
json_ssrcTable
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
ssrcTable
)
{
auto
ssrc
=
kv
.
first
;
auto
rtpReceiver
=
kv
.
second
;
json_ssrcTable
[
std
::
to_string
(
ssrc
)]
=
std
::
to_string
(
rtpReceiver
->
rtpReceiverId
);
}
json
[
k_ssrcTable
]
=
json_ssrcTable
;
// TODO: Add `midTable`.
// Add `ptTable`.
Json
::
Value
json_ptTable
(
Json
::
objectValue
);
for
(
auto
&
kv
:
this
->
ptTable
)
{
auto
payloadType
=
kv
.
first
;
auto
rtpReceiver
=
kv
.
second
;
json_ptTable
[
std
::
to_string
(
payloadType
)]
=
std
::
to_string
(
rtpReceiver
->
rtpReceiverId
);
}
json
[
k_ptTable
]
=
json_ptTable
;
return
json
;
}
void
RtpListener
::
AddRtpReceiver
(
RTC
::
RtpReceiver
*
rtpReceiver
,
RTC
::
RtpParameters
*
rtpParameters
)
{
MS_TRACE
();
// First remove from the tables all the entries pointing to the given RtpReceiver (reset them).
RemoveRtpReceiver
(
rtpReceiver
);
// Add entries into ssrcTable.
for
(
auto
&
encoding
:
rtpParameters
->
encodings
)
{
// TODO: This should throw if the ssrc already exists in the table,
// and the receive() should Reject() the Request.
if
(
encoding
.
ssrc
)
this
->
ssrcTable
[
encoding
.
ssrc
]
=
rtpReceiver
;
}
// TODO: // Add entries into midTable.
// Add entries into ptTable.
// TODO: This is wrong, pt should not be added if ssrc are added.
for
(
auto
&
codec
:
rtpParameters
->
codecs
)
{
this
->
ptTable
[
codec
.
payloadType
]
=
rtpReceiver
;
}
}
void
RtpListener
::
RemoveRtpReceiver
(
RTC
::
RtpReceiver
*
rtpReceiver
)
{
MS_TRACE
();
// Remove from the tables all the entries pointing to the given RtpReceiver.
for
(
auto
it
=
this
->
ssrcTable
.
begin
();
it
!=
this
->
ssrcTable
.
end
();)
{
if
(
it
->
second
==
rtpReceiver
)
it
=
this
->
ssrcTable
.
erase
(
it
);
else
it
++
;
}
// TODO: midTable
for
(
auto
it
=
this
->
ptTable
.
begin
();
it
!=
this
->
ptTable
.
end
();)
{
if
(
it
->
second
==
rtpReceiver
)
it
=
this
->
ptTable
.
erase
(
it
);
else
it
++
;
}
}
RTC
::
RtpReceiver
*
RtpListener
::
GetRtpReceiver
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
// TODO: read the ORTC doc.
// Check the SSRC table.
auto
it
=
this
->
ssrcTable
.
find
(
packet
->
GetSsrc
());
if
(
it
==
this
->
ssrcTable
.
end
())
{
return
nullptr
;
}
else
{
return
it
->
second
;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论