Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
507f8cca
提交
507f8cca
authored
11月 30, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RtpBuffer: initial implementation (not finished yet)
上级
e6ce9ebe
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
95 行增加
和
0 行删除
+95
-0
RtpBuffer.h
worker/include/RTC/RtpBuffer.h
+34
-0
RtpReceiver.h
worker/include/RTC/RtpReceiver.h
+2
-0
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+2
-0
RtpBuffer.cpp
worker/src/RTC/RtpBuffer.cpp
+45
-0
RtpReceiver.cpp
worker/src/RTC/RtpReceiver.cpp
+12
-0
没有找到文件。
worker/include/RTC/RtpBuffer.h
0 → 100644
浏览文件 @
507f8cca
#ifndef MS_RTC_RTP_BUFFER_H
#define MS_RTC_RTP_BUFFER_H
#include "common.h"
#include "RTC/RtpPacket.h"
#include <vector>
#define MS_RTP_PACKET_MAX_SIZE 65536
namespace
RTC
{
class
RtpBuffer
{
public
:
struct
Item
{
uint8_t
raw
[
MS_RTP_PACKET_MAX_SIZE
];
RTC
::
RtpPacket
*
packet
=
nullptr
;
};
public
:
RtpBuffer
(
size_t
capability
);
virtual
~
RtpBuffer
();
void
Add
(
RTC
::
RtpPacket
*
packet
);
private
:
std
::
vector
<
Item
>
items
;
size_t
pos
=
0
;
bool
full
=
false
;
};
}
#endif
worker/include/RTC/RtpReceiver.h
浏览文件 @
507f8cca
...
...
@@ -4,6 +4,7 @@
#include "common.h"
#include "RTC/RtpDictionaries.h"
#include "RTC/RtpPacket.h"
#include "RTC/RtpBuffer.h"
#include "RTC/RTCP/ReceiverReport.h"
#include "RTC/RTCP/Feedback.h"
#include "Channel/Request.h"
...
...
@@ -65,6 +66,7 @@ namespace RTC
RTC
::
Transport
*
transport
=
nullptr
;
// Allocated by this.
RTC
::
RtpParameters
*
rtpParameters
=
nullptr
;
RTC
::
RtpBuffer
*
rtpBuffer
=
nullptr
;
// Others.
bool
rtpRawEventEnabled
=
false
;
bool
rtpObjectEventEnabled
=
false
;
...
...
worker/mediasoup-worker.gyp
浏览文件 @
507f8cca
...
...
@@ -31,6 +31,7 @@
'src/RTC/IceServer.cpp',
'src/RTC/Peer.cpp',
'src/RTC/Room.cpp',
'src/RTC/RtpBuffer.cpp',
'src/RTC/RtpListener.cpp',
'src/RTC/RtpPacket.cpp',
'src/RTC/RtpReceiver.cpp',
...
...
@@ -107,6 +108,7 @@
'include/RTC/Parameters.h',
'include/RTC/Peer.h',
'include/RTC/Room.h',
'include/RTC/RtpBuffer.h',
'include/RTC/RtpDictionaries.h',
'include/RTC/RtpListener.h',
'include/RTC/RtpPacket.h',
...
...
worker/src/RTC/RtpBuffer.cpp
0 → 100644
浏览文件 @
507f8cca
#define MS_CLASS "RTC::RtpBuffer"
#include "RTC/RtpBuffer.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtpBuffer
::
RtpBuffer
(
size_t
capability
)
:
items
(
capability
)
{
MS_TRACE
();
}
RtpBuffer
::~
RtpBuffer
()
{
MS_TRACE
();
// Delete cloned packets.
for
(
auto
&
item
:
this
->
items
)
{
if
(
item
.
packet
)
delete
item
.
packet
;
}
}
void
RtpBuffer
::
Add
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
Item
*
item
=
std
::
addressof
(
this
->
items
[
this
->
pos
]);
// Delete previous RTP packet (if any).
if
(
item
->
packet
)
delete
item
->
packet
;
// Clone the given RTP packet and store it.
item
->
packet
=
packet
->
Clone
(
item
->
raw
);
this
->
pos
=
(
this
->
pos
+
1
)
%
this
->
items
.
size
();
if
(
!
this
->
full
&&
this
->
pos
==
0
)
this
->
full
=
true
;
}
}
worker/src/RTC/RtpReceiver.cpp
浏览文件 @
507f8cca
...
...
@@ -6,6 +6,8 @@
#include "MediaSoupError.h"
#include "Logger.h"
#define RTP_BUFFER_SIZE 100
namespace
RTC
{
/* Instance methods. */
...
...
@@ -17,6 +19,9 @@ namespace RTC
notifier
(
notifier
)
{
MS_TRACE
();
// Create the RtpBuffer instance.
this
->
rtpBuffer
=
new
RTC
::
RtpBuffer
(
RTP_BUFFER_SIZE
);
}
RtpReceiver
::~
RtpReceiver
()
...
...
@@ -35,6 +40,9 @@ namespace RTC
if
(
this
->
rtpParameters
)
delete
this
->
rtpParameters
;
if
(
this
->
rtpBuffer
)
delete
this
->
rtpBuffer
;
// Notify.
event_data
[
k_class
]
=
"RtpReceiver"
;
this
->
notifier
->
Emit
(
this
->
rtpReceiverId
,
"close"
,
event_data
);
...
...
@@ -240,6 +248,10 @@ namespace RTC
this
->
notifier
->
EmitWithBinary
(
this
->
rtpReceiverId
,
"rtpobject"
,
event_data
,
packet
->
GetPayload
(),
packet
->
GetPayloadLength
());
}
// Store in the buffer
// TODO: Must check what kind of packet we are storing, right?
this
->
rtpBuffer
->
Add
(
packet
);
}
void
RtpReceiver
::
FillRtpParameters
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论