Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
ae310629
提交
ae310629
authored
12月 21, 2016
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove old RtpBuffer implementation (let's work on RtpStream)
上级
3dd89a71
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
0 行增加
和
156 行删除
+0
-156
RtpBuffer.h
worker/include/RTC/RtpBuffer.h
+0
-32
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+0
-2
RtpBuffer.cpp
worker/src/RTC/RtpBuffer.cpp
+0
-122
没有找到文件。
worker/include/RTC/RtpBuffer.h
deleted
100644 → 0
浏览文件 @
3dd89a71
#ifndef MS_RTC_RTP_BUFFER_H
#define MS_RTC_RTP_BUFFER_H
#include "common.h"
#include "RTC/RtpPacket.h"
#include <vector>
#include <list>
namespace
RTC
{
class
RtpBuffer
{
private
:
struct
StorageItem
{
uint8_t
store
[
65536
];
};
public
:
RtpBuffer
(
size_t
size
);
~
RtpBuffer
();
bool
Add
(
RTC
::
RtpPacket
*
packet
);
private
:
std
::
vector
<
StorageItem
>
storage
;
typedef
std
::
list
<
RTC
::
RtpPacket
*>
Packets
;
Packets
packets
;
};
}
#endif
worker/mediasoup-worker.gyp
浏览文件 @
ae310629
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
'src/RTC/IceServer.cpp',
'src/RTC/IceServer.cpp',
'src/RTC/Peer.cpp',
'src/RTC/Peer.cpp',
'src/RTC/Room.cpp',
'src/RTC/Room.cpp',
'src/RTC/RtpBuffer.cpp',
'src/RTC/RtpListener.cpp',
'src/RTC/RtpListener.cpp',
'src/RTC/RtpPacket.cpp',
'src/RTC/RtpPacket.cpp',
'src/RTC/RtpReceiver.cpp',
'src/RTC/RtpReceiver.cpp',
...
@@ -108,7 +107,6 @@
...
@@ -108,7 +107,6 @@
'include/RTC/Parameters.h',
'include/RTC/Parameters.h',
'include/RTC/Peer.h',
'include/RTC/Peer.h',
'include/RTC/Room.h',
'include/RTC/Room.h',
'include/RTC/RtpBuffer.h',
'include/RTC/RtpDictionaries.h',
'include/RTC/RtpDictionaries.h',
'include/RTC/RtpListener.h',
'include/RTC/RtpListener.h',
'include/RTC/RtpPacket.h',
'include/RTC/RtpPacket.h',
...
...
worker/src/RTC/RtpBuffer.cpp
deleted
100644 → 0
浏览文件 @
3dd89a71
// TODO: https://tools.ietf.org/html/rfc3550#appendix-A.1
#define MS_CLASS "RTC::RtpBuffer"
#include "RTC/RtpBuffer.h"
#include "Logger.h"
namespace
RTC
{
/* Instance methods. */
RtpBuffer
::
RtpBuffer
(
size_t
size
)
:
storage
(
size
)
{
MS_TRACE
();
}
RtpBuffer
::~
RtpBuffer
()
{
MS_TRACE
();
// Delete cloned packets.
for
(
auto
&
packet
:
this
->
packets
)
{
delete
packet
;
}
}
bool
RtpBuffer
::
Add
(
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
MS_WARN
(
"BEGIN | seq_number: %"
PRIu16
,
packet
->
GetSequenceNumber
());
// If empty do it easy.
if
(
this
->
packets
.
size
()
==
0
)
{
MS_WARN
(
" empty packet list"
);
auto
store
=
this
->
storage
[
0
].
store
;
auto
cloned_packet
=
packet
->
Clone
(
store
);
this
->
packets
.
push_back
(
cloned_packet
);
MS_WARN
(
"END | seq_number: %"
PRIu16
,
packet
->
GetSequenceNumber
());
return
true
;
}
// Otherwise, do the stuff.
Packets
::
iterator
new_it
;
uint8_t
*
store
=
nullptr
;
auto
it_r
=
this
->
packets
.
rbegin
();
for
(;
it_r
!=
this
->
packets
.
rend
();
it_r
++
)
{
auto
current_packet
=
*
it_r
;
if
(
packet
->
GetSequenceNumber
()
>
current_packet
->
GetSequenceNumber
())
{
// Get a forward iterator pointing to the same element.
auto
it
=
it_r
.
base
();
new_it
=
this
->
packets
.
insert
(
it
,
nullptr
);
// Exit the loop.
break
;
}
}
// If the packet was older than anything in the storate, just ignore it.
if
(
it_r
==
this
->
packets
.
rend
())
{
// TODO: Wrong, this will drop all the received packets once sequence_number
// reaches 65535
MS_WARN
(
" packet is older than anything in the storage, ignoring it"
);
MS_WARN
(
"END | seq_number: %"
PRIu16
,
packet
->
GetSequenceNumber
());
return
false
;
}
MS_WARN
(
" packets.size:%zu, storage.size:%zu"
,
this
->
packets
.
size
(),
this
->
storage
.
size
());
// If the storage is not full use the next free area.
if
(
this
->
packets
.
size
()
-
1
<
this
->
storage
.
size
())
{
MS_WARN
(
" storage not full"
);
// Store points to the next free mem area.
store
=
this
->
storage
[
this
->
packets
.
size
()
-
1
].
store
;
}
// Otherwise remove the first packet list entry and replace its storage area.
else
{
auto
first_packet
=
*
(
this
->
packets
.
begin
());
MS_WARN
(
" storage full, deleting first list packet with seq_number: %"
PRIu16
,
first_packet
->
GetSequenceNumber
());
// Store points to the store used by the first packet.
store
=
(
uint8_t
*
)
first_packet
->
GetRaw
();
// Free the first packet.
delete
first_packet
;
// Remove the first element in the list.
this
->
packets
.
pop_front
();
}
// Update the new list entry so it points to the cloned packed.
*
new_it
=
packet
->
Clone
(
store
);
MS_WARN
(
"END | seq_number: %"
PRIu16
,
packet
->
GetSequenceNumber
());
MS_WARN
(
"<DUMP>"
);
for
(
auto
&
packet
:
this
->
packets
)
{
MS_WARN
(
" - seq_number: %"
PRIu16
,
packet
->
GetSequenceNumber
());
}
MS_WARN
(
"</DUMP>
\n
"
);
return
true
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论