Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
1990944b
提交
1990944b
authored
11月 18, 2019
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Producer and Consumer: add 'keyframe' into valid 'packet' event types
上级
3bae47a1
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
69 行增加
和
2 行删除
+69
-2
Consumer.ts
src/Consumer.ts
+1
-1
Producer.ts
src/Producer.ts
+1
-1
Consumer.hpp
worker/include/RTC/Consumer.hpp
+2
-0
Producer.hpp
worker/include/RTC/Producer.hpp
+2
-0
Consumer.cpp
worker/src/RTC/Consumer.cpp
+27
-0
PipeConsumer.cpp
worker/src/RTC/PipeConsumer.cpp
+2
-0
Producer.cpp
worker/src/RTC/Producer.cpp
+28
-0
SimpleConsumer.cpp
worker/src/RTC/SimpleConsumer.cpp
+2
-0
SimulcastConsumer.cpp
worker/src/RTC/SimulcastConsumer.cpp
+2
-0
SvcConsumer.cpp
worker/src/RTC/SvcConsumer.cpp
+2
-0
没有找到文件。
src/Consumer.ts
浏览文件 @
1990944b
...
@@ -51,7 +51,7 @@ export interface ConsumerOptions
...
@@ -51,7 +51,7 @@ export interface ConsumerOptions
/**
/**
* Valid types for 'packet' event.
* Valid types for 'packet' event.
*/
*/
export
type
ConsumerPacketEventType
=
'rtp'
|
'nack'
|
'pli'
|
'fir'
;
export
type
ConsumerPacketEventType
=
'rtp'
|
'
keyframe'
|
'
nack'
|
'pli'
|
'fir'
;
/**
/**
* 'packet' event data.
* 'packet' event data.
...
...
src/Producer.ts
浏览文件 @
1990944b
...
@@ -34,7 +34,7 @@ export interface ProducerOptions
...
@@ -34,7 +34,7 @@ export interface ProducerOptions
/**
/**
* Valid types for 'packet' event.
* Valid types for 'packet' event.
*/
*/
export
type
ProducerPacketEventType
=
'rtp'
|
'nack'
|
'pli'
|
'fir'
;
export
type
ProducerPacketEventType
=
'rtp'
|
'
keyframe'
|
'
nack'
|
'pli'
|
'fir'
;
/**
/**
* 'packet' event data.
* 'packet' event data.
...
...
worker/include/RTC/Consumer.hpp
浏览文件 @
1990944b
...
@@ -41,6 +41,7 @@ namespace RTC
...
@@ -41,6 +41,7 @@ namespace RTC
struct
PacketEventTypes
struct
PacketEventTypes
{
{
bool
rtp
{
false
};
bool
rtp
{
false
};
bool
keyframe
{
false
};
bool
nack
{
false
};
bool
nack
{
false
};
bool
pli
{
false
};
bool
pli
{
false
};
bool
fir
{
false
};
bool
fir
{
false
};
...
@@ -98,6 +99,7 @@ namespace RTC
...
@@ -98,6 +99,7 @@ namespace RTC
protected
:
protected
:
void
EmitPacketEventRtpType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventRtpType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventKeyFrameType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventNackType
()
const
;
void
EmitPacketEventNackType
()
const
;
...
...
worker/include/RTC/Producer.hpp
浏览文件 @
1990944b
...
@@ -76,6 +76,7 @@ namespace RTC
...
@@ -76,6 +76,7 @@ namespace RTC
struct
PacketEventTypes
struct
PacketEventTypes
{
{
bool
rtp
{
false
};
bool
rtp
{
false
};
bool
keyframe
{
false
};
bool
nack
{
false
};
bool
nack
{
false
};
bool
pli
{
false
};
bool
pli
{
false
};
bool
fir
{
false
};
bool
fir
{
false
};
...
@@ -111,6 +112,7 @@ namespace RTC
...
@@ -111,6 +112,7 @@ namespace RTC
void
PostProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
PostProcessRtpPacket
(
RTC
::
RtpPacket
*
packet
);
void
EmitScore
()
const
;
void
EmitScore
()
const
;
void
EmitPacketEventRtpType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventRtpType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventKeyFrameType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
=
false
)
const
;
void
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventFirType
(
uint32_t
ssrc
)
const
;
void
EmitPacketEventNackType
()
const
;
void
EmitPacketEventNackType
()
const
;
...
...
worker/src/RTC/Consumer.cpp
浏览文件 @
1990944b
...
@@ -198,6 +198,8 @@ namespace RTC
...
@@ -198,6 +198,8 @@ namespace RTC
if
(
this
->
packetEventTypes
.
rtp
)
if
(
this
->
packetEventTypes
.
rtp
)
packetEventTypes
.
emplace_back
(
"rtp"
);
packetEventTypes
.
emplace_back
(
"rtp"
);
if
(
this
->
packetEventTypes
.
keyframe
)
packetEventTypes
.
emplace_back
(
"keyframe"
);
if
(
this
->
packetEventTypes
.
nack
)
if
(
this
->
packetEventTypes
.
nack
)
packetEventTypes
.
emplace_back
(
"nack"
);
packetEventTypes
.
emplace_back
(
"nack"
);
if
(
this
->
packetEventTypes
.
pli
)
if
(
this
->
packetEventTypes
.
pli
)
...
@@ -309,6 +311,8 @@ namespace RTC
...
@@ -309,6 +311,8 @@ namespace RTC
if
(
typeStr
==
"rtp"
)
if
(
typeStr
==
"rtp"
)
newPacketEventTypes
.
rtp
=
true
;
newPacketEventTypes
.
rtp
=
true
;
else
if
(
typeStr
==
"keyframe"
)
newPacketEventTypes
.
keyframe
=
true
;
else
if
(
typeStr
==
"nack"
)
else
if
(
typeStr
==
"nack"
)
newPacketEventTypes
.
nack
=
true
;
newPacketEventTypes
.
nack
=
true
;
else
if
(
typeStr
==
"pli"
)
else
if
(
typeStr
==
"pli"
)
...
@@ -425,6 +429,29 @@ namespace RTC
...
@@ -425,6 +429,29 @@ namespace RTC
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
}
}
void
Consumer
::
EmitPacketEventKeyFrameType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
)
const
{
MS_TRACE
();
if
(
!
this
->
packetEventTypes
.
keyframe
)
return
;
else
if
(
!
packet
->
IsKeyFrame
())
return
;
json
data
=
json
::
object
();
data
[
"type"
]
=
"keyframe"
;
data
[
"timestamp"
]
=
DepLibUV
::
GetTimeMs
();
data
[
"direction"
]
=
"out"
;
packet
->
FillJson
(
data
[
"info"
]);
if
(
isRtx
)
data
[
"info"
][
"isRtx"
]
=
true
;
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
}
void
Consumer
::
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
void
Consumer
::
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/PipeConsumer.cpp
浏览文件 @
1990944b
...
@@ -247,6 +247,7 @@ namespace RTC
...
@@ -247,6 +247,7 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
);
EmitPacketEventRtpType
(
packet
);
EmitPacketEventKeyFrameType
(
packet
);
}
}
else
else
{
{
...
@@ -575,5 +576,6 @@ namespace RTC
...
@@ -575,5 +576,6 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
,
rtpStream
->
HasRtx
());
EmitPacketEventRtpType
(
packet
,
rtpStream
->
HasRtx
());
EmitPacketEventKeyFrameType
(
packet
,
rtpStream
->
HasRtx
());
}
}
}
// namespace RTC
}
// namespace RTC
worker/src/RTC/Producer.cpp
浏览文件 @
1990944b
...
@@ -345,6 +345,8 @@ namespace RTC
...
@@ -345,6 +345,8 @@ namespace RTC
if
(
this
->
packetEventTypes
.
rtp
)
if
(
this
->
packetEventTypes
.
rtp
)
packetEventTypes
.
emplace_back
(
"rtp"
);
packetEventTypes
.
emplace_back
(
"rtp"
);
if
(
this
->
packetEventTypes
.
keyframe
)
packetEventTypes
.
emplace_back
(
"keyframe"
);
if
(
this
->
packetEventTypes
.
nack
)
if
(
this
->
packetEventTypes
.
nack
)
packetEventTypes
.
emplace_back
(
"nack"
);
packetEventTypes
.
emplace_back
(
"nack"
);
if
(
this
->
packetEventTypes
.
pli
)
if
(
this
->
packetEventTypes
.
pli
)
...
@@ -500,6 +502,8 @@ namespace RTC
...
@@ -500,6 +502,8 @@ namespace RTC
if
(
typeStr
==
"rtp"
)
if
(
typeStr
==
"rtp"
)
newPacketEventTypes
.
rtp
=
true
;
newPacketEventTypes
.
rtp
=
true
;
else
if
(
typeStr
==
"keyframe"
)
newPacketEventTypes
.
keyframe
=
true
;
else
if
(
typeStr
==
"nack"
)
else
if
(
typeStr
==
"nack"
)
newPacketEventTypes
.
nack
=
true
;
newPacketEventTypes
.
nack
=
true
;
else
if
(
typeStr
==
"pli"
)
else
if
(
typeStr
==
"pli"
)
...
@@ -614,6 +618,7 @@ namespace RTC
...
@@ -614,6 +618,7 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
,
isRtx
);
EmitPacketEventRtpType
(
packet
,
isRtx
);
EmitPacketEventKeyFrameType
(
packet
,
isRtx
);
// Mangle the packet before providing the listener with it.
// Mangle the packet before providing the listener with it.
if
(
!
MangleRtpPacket
(
packet
,
rtpStream
))
if
(
!
MangleRtpPacket
(
packet
,
rtpStream
))
...
@@ -1359,6 +1364,29 @@ namespace RTC
...
@@ -1359,6 +1364,29 @@ namespace RTC
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
}
}
inline
void
Producer
::
EmitPacketEventKeyFrameType
(
RTC
::
RtpPacket
*
packet
,
bool
isRtx
)
const
{
MS_TRACE
();
if
(
!
this
->
packetEventTypes
.
keyframe
)
return
;
else
if
(
!
packet
->
IsKeyFrame
())
return
;
json
data
=
json
::
object
();
data
[
"type"
]
=
"keyframe"
;
data
[
"timestamp"
]
=
DepLibUV
::
GetTimeMs
();
data
[
"direction"
]
=
"in"
;
packet
->
FillJson
(
data
[
"info"
]);
if
(
isRtx
)
data
[
"info"
][
"isRtx"
]
=
true
;
Channel
::
Notifier
::
Emit
(
this
->
id
,
"packet"
,
data
);
}
inline
void
Producer
::
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
inline
void
Producer
::
EmitPacketEventPliType
(
uint32_t
ssrc
)
const
{
{
MS_TRACE
();
MS_TRACE
();
...
...
worker/src/RTC/SimpleConsumer.cpp
浏览文件 @
1990944b
...
@@ -245,6 +245,7 @@ namespace RTC
...
@@ -245,6 +245,7 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
);
EmitPacketEventRtpType
(
packet
);
EmitPacketEventKeyFrameType
(
packet
);
}
}
else
else
{
{
...
@@ -526,5 +527,6 @@ namespace RTC
...
@@ -526,5 +527,6 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventKeyFrameType
(
packet
,
this
->
rtpStream
->
HasRtx
());
}
}
}
// namespace RTC
}
// namespace RTC
worker/src/RTC/SimulcastConsumer.cpp
浏览文件 @
1990944b
...
@@ -1090,6 +1090,7 @@ namespace RTC
...
@@ -1090,6 +1090,7 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
);
EmitPacketEventRtpType
(
packet
);
EmitPacketEventKeyFrameType
(
packet
);
}
}
else
else
{
{
...
@@ -1695,5 +1696,6 @@ namespace RTC
...
@@ -1695,5 +1696,6 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventKeyFrameType
(
packet
,
this
->
rtpStream
->
HasRtx
());
}
}
}
// namespace RTC
}
// namespace RTC
worker/src/RTC/SvcConsumer.cpp
浏览文件 @
1990944b
...
@@ -821,6 +821,7 @@ namespace RTC
...
@@ -821,6 +821,7 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
);
EmitPacketEventRtpType
(
packet
);
EmitPacketEventKeyFrameType
(
packet
);
}
}
else
else
{
{
...
@@ -1288,5 +1289,6 @@ namespace RTC
...
@@ -1288,5 +1289,6 @@ namespace RTC
// May emit 'packet' event.
// May emit 'packet' event.
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventRtpType
(
packet
,
this
->
rtpStream
->
HasRtx
());
EmitPacketEventKeyFrameType
(
packet
,
this
->
rtpStream
->
HasRtx
());
}
}
}
// namespace RTC
}
// namespace RTC
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论