Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
e936e666
提交
e936e666
authored
9月 13, 2017
作者:
José Luis Millán
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
VP8: Key frame detection
上级
8f75544e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
173 行增加
和
0 行删除
+173
-0
Codecs.hpp
worker/include/RTC/Codecs/Codecs.hpp
+18
-0
VP8.hpp
worker/include/RTC/Codecs/VP8.hpp
+18
-0
RtpStream.hpp
worker/include/RTC/RtpStream.hpp
+6
-0
mediasoup-worker.gyp
worker/mediasoup-worker.gyp
+4
-0
Codecs.cpp
worker/src/RTC/Codecs/Codecs.cpp
+50
-0
VP8.cpp
worker/src/RTC/Codecs/VP8.cpp
+77
-0
没有找到文件。
worker/include/RTC/Codecs/Codecs.hpp
0 → 100644
浏览文件 @
e936e666
#ifndef MS_RTC_CODECS_HPP
#define MS_RTC_CODECS_HPP
#include "common.hpp"
#include "RTC/Codecs/VP8.hpp"
#include "RTC/RtpDictionaries.hpp"
#include "RTC/RtpPacket.hpp"
namespace
RTC
{
namespace
Codecs
{
bool
isKnown
(
const
RTC
::
RtpCodecMimeType
&
mimeType
);
bool
isKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
,
const
RTC
::
RtpPacket
*
packet
);
}
// namespace Codecs
}
// namespace RTC
#endif
worker/include/RTC/Codecs/VP8.hpp
0 → 100644
浏览文件 @
e936e666
#ifndef MS_RTC_CODECS_VP8_HPP
#define MS_RTC_CODECS_VP8_HPP
#include "common.hpp"
namespace
RTC
{
namespace
Codecs
{
class
VP8
{
public
:
static
bool
isKeyFrame
(
const
uint8_t
*
data
,
size_t
len
);
};
}
// namespace Codecs
}
// namespace RTC
#endif
worker/include/RTC/RtpStream.hpp
浏览文件 @
e936e666
...
@@ -38,6 +38,7 @@ namespace RTC
...
@@ -38,6 +38,7 @@ namespace RTC
virtual
Json
::
Value
ToJson
()
=
0
;
virtual
Json
::
Value
ToJson
()
=
0
;
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
virtual
bool
ReceivePacket
(
RTC
::
RtpPacket
*
packet
);
uint32_t
GetSsrc
();
uint32_t
GetSsrc
();
const
RTC
::
RtpCodecMimeType
&
GetMymeType
()
const
;
bool
IsHealthy
();
bool
IsHealthy
();
protected
:
protected
:
...
@@ -82,6 +83,11 @@ namespace RTC
...
@@ -82,6 +83,11 @@ namespace RTC
return
this
->
params
.
ssrc
;
return
this
->
params
.
ssrc
;
}
}
inline
const
RTC
::
RtpCodecMimeType
&
RtpStream
::
GetMymeType
()
const
{
return
this
->
params
.
mime
;
}
inline
bool
RtpStream
::
IsHealthy
()
inline
bool
RtpStream
::
IsHealthy
()
{
{
return
this
->
healthy
;
return
this
->
healthy
;
...
...
worker/mediasoup-worker.gyp
浏览文件 @
e936e666
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
'src/RTC/Transport.cpp',
'src/RTC/Transport.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/TransportTuple.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/UdpSocket.cpp',
'src/RTC/Codecs/Codecs.cpp',
'src/RTC/Codecs/VP8.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Media.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/Parameters.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
'src/RTC/RtpDictionaries/RtcpFeedback.cpp',
...
@@ -129,6 +131,8 @@
...
@@ -129,6 +131,8 @@
'include/RTC/Transport.hpp',
'include/RTC/Transport.hpp',
'include/RTC/TransportTuple.hpp',
'include/RTC/TransportTuple.hpp',
'include/RTC/UdpSocket.hpp',
'include/RTC/UdpSocket.hpp',
'include/RTC/Codecs/Codecs.hpp',
'include/RTC/Codecs/VP8.hpp',
'include/RTC/RTCP/Packet.hpp',
'include/RTC/RTCP/Packet.hpp',
'include/RTC/RTCP/CompoundPacket.hpp',
'include/RTC/RTCP/CompoundPacket.hpp',
'include/RTC/RTCP/SenderReport.hpp',
'include/RTC/RTCP/SenderReport.hpp',
...
...
worker/src/RTC/Codecs/Codecs.cpp
0 → 100644
浏览文件 @
e936e666
#define MS_CLASS "RTC::Codecs"
#define MS_LOG_DEV
#include "RTC/Codecs/Codecs.hpp"
#include "Logger.hpp"
#include "RTC/Codecs/VP8.hpp"
namespace
RTC
{
namespace
Codecs
{
bool
isKnown
(
const
RTC
::
RtpCodecMimeType
&
mimeType
)
{
MS_TRACE
();
if
(
mimeType
.
type
!=
RTC
::
RtpCodecMimeType
::
Type
::
VIDEO
)
return
false
;
switch
(
mimeType
.
subtype
)
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
return
true
;
default
:
return
false
;
}
}
bool
isKeyFrame
(
const
RTC
::
RtpCodecMimeType
&
mimeType
,
const
RTC
::
RtpPacket
*
packet
)
{
MS_TRACE
();
if
(
!
isKnown
(
mimeType
))
return
false
;
auto
data
=
packet
->
GetPayload
();
auto
len
=
packet
->
GetPayloadLength
();
switch
(
mimeType
.
subtype
)
{
case
RTC
:
:
RtpCodecMimeType
::
Subtype
::
VP8
:
return
VP8
::
isKeyFrame
(
data
,
len
);
default
:
MS_DEBUG_TAG
(
rtp
,
"requested key frame for an unsupported codec: %s"
,
mimeType
.
GetName
().
c_str
());
return
false
;
}
}
}
// namespace Codecs
}
// namespace RTC
worker/src/RTC/Codecs/VP8.cpp
0 → 100644
浏览文件 @
e936e666
#define MS_CLASS "RTC::Codecs::VP8"
#define MS_LOG_DEV
#include "RTC/Codecs/VP8.hpp"
#include "Logger.hpp"
#include "Utils.hpp"
namespace
RTC
{
namespace
Codecs
{
bool
VP8
::
isKeyFrame
(
const
uint8_t
*
data
,
size_t
len
)
{
if
(
len
<
1
)
return
false
;
size_t
offset
=
0
;
uint8_t
byte
=
data
[
offset
++
];
uint8_t
x
=
(
byte
>>
7
)
&
0x1
;
uint8_t
start
=
(
byte
>>
4
)
&
0x1
;
uint8_t
pid
=
byte
&
0x07
;
uint8_t
i
=
0
;
uint8_t
l
=
0
;
uint8_t
t
=
0
;
uint8_t
k
=
0
;
if
(
x
)
{
{
if
(
len
<
offset
+
1
)
return
false
;
}
byte
=
data
[
offset
++
];
i
=
(
byte
>>
7
)
&
0x1
;
l
=
(
byte
>>
6
)
&
0x1
;
t
=
(
byte
>>
5
)
&
0x1
;
k
=
(
byte
>>
4
)
&
0x1
;
}
if
(
i
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
if
((
byte
>>
7
)
&
0x1
)
{
if
(
len
<
offset
++
)
return
false
;
}
}
if
(
l
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
}
if
(
t
||
k
)
{
if
(
len
<
offset
++
)
{
return
false
;
}
}
return
start
&&
pid
==
0
&&
(
!
(
data
[
offset
]
&
0x1
));
}
}
// namespace Codecs
}
// namespace RTC
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论