Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
f4ee607f
Commit
f4ee607f
authored
May 11, 2023
by
Johnny
Committed by
夏楚
May 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add RtspMediaSource::Clone
parent
51e93132
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
21 行增加
和
9 行删除
+21
-9
src/Rtsp/RtspMediaSource.h
+4
-0
src/Rtsp/RtspMediaSourceImp.cpp
+6
-0
src/Rtsp/RtspMediaSourceImp.h
+1
-0
webrtc/WebRtcPusher.cpp
+4
-5
webrtc/WebRtcPusher.h
+4
-4
webrtc/WebRtcTransport.cpp
+2
-0
没有找到文件。
src/Rtsp/RtspMediaSource.h
查看文件 @
f4ee607f
...
...
@@ -76,6 +76,10 @@ public:
return
_sdp
;
}
virtual
RtspMediaSource
::
Ptr
Clone
(
const
std
::
string
&
stream
)
{
return
nullptr
;
}
/**
* 获取相应轨道的ssrc
*/
...
...
src/Rtsp/RtspMediaSourceImp.cpp
查看文件 @
f4ee607f
...
...
@@ -126,6 +126,12 @@ void RtspMediaSourceImp::setProtocolOption(const ProtocolOption &option)
}
}
RtspMediaSource
::
Ptr
RtspMediaSourceImp
::
Clone
(
const
std
::
string
&
stream
)
{
auto
src_imp
=
std
::
make_shared
<
RtspMediaSourceImp
>
(
getVhost
(),
getApp
(),
stream
);
src_imp
->
setSdp
(
getSdp
());
src_imp
->
setProtocolOption
(
getProtocolOption
());
return
src_imp
;
}
}
src/Rtsp/RtspMediaSourceImp.h
查看文件 @
f4ee607f
...
...
@@ -107,6 +107,7 @@ public:
}
}
RtspMediaSource
::
Ptr
Clone
(
const
std
::
string
&
stream
)
override
;
private
:
bool
_all_track_ready
=
false
;
ProtocolOption
_option
;
...
...
webrtc/WebRtcPusher.cpp
查看文件 @
f4ee607f
...
...
@@ -10,13 +10,14 @@
#include "WebRtcPusher.h"
#include "Common/config.h"
#include "Rtsp/RtspMediaSourceImp.h"
using
namespace
std
;
namespace
mediakit
{
WebRtcPusher
::
Ptr
WebRtcPusher
::
create
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
Imp
::
Ptr
&
src
,
const
RtspMediaSource
::
Ptr
&
src
,
const
std
::
shared_ptr
<
void
>
&
ownership
,
const
MediaInfo
&
info
,
const
ProtocolOption
&
option
,
...
...
@@ -30,7 +31,7 @@ WebRtcPusher::Ptr WebRtcPusher::create(const EventPoller::Ptr &poller,
}
WebRtcPusher
::
WebRtcPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
Imp
::
Ptr
&
src
,
const
RtspMediaSource
::
Ptr
&
src
,
const
std
::
shared_ptr
<
void
>
&
ownership
,
const
MediaInfo
&
info
,
const
ProtocolOption
&
option
,
...
...
@@ -98,10 +99,8 @@ void WebRtcPusher::onRecvRtp(MediaTrack &track, const string &rid, RtpPacket::Pt
auto
&
src
=
_push_src_sim
[
rid
];
if
(
!
src
)
{
auto
stream_id
=
rid
.
empty
()
?
_push_src
->
getId
()
:
_push_src
->
getId
()
+
"_"
+
rid
;
auto
src_imp
=
std
::
make_shared
<
RtspMediaSourceImp
>
(
_push_src
->
getVhost
(),
_push_src
->
getApp
(),
stream_id
);
auto
src_imp
=
_push_src
->
Clone
(
stream_id
);
_push_src_sim_ownership
[
rid
]
=
src_imp
->
getOwnership
();
src_imp
->
setSdp
(
_push_src
->
getSdp
());
src_imp
->
setProtocolOption
(
_push_src
->
getProtocolOption
());
src_imp
->
setListener
(
static_pointer_cast
<
WebRtcPusher
>
(
shared_from_this
()));
src
=
src_imp
;
}
...
...
webrtc/WebRtcPusher.h
查看文件 @
f4ee607f
...
...
@@ -12,7 +12,7 @@
#define ZLMEDIAKIT_WEBRTCPUSHER_H
#include "WebRtcTransport.h"
#include "Rtsp/RtspMediaSource
Imp
.h"
#include "Rtsp/RtspMediaSource.h"
namespace
mediakit
{
...
...
@@ -20,7 +20,7 @@ class WebRtcPusher : public WebRtcTransportImp, public MediaSourceEvent {
public
:
using
Ptr
=
std
::
shared_ptr
<
WebRtcPusher
>
;
~
WebRtcPusher
()
override
=
default
;
static
Ptr
create
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
Imp
::
Ptr
&
src
,
static
Ptr
create
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
::
Ptr
&
src
,
const
std
::
shared_ptr
<
void
>
&
ownership
,
const
MediaInfo
&
info
,
const
ProtocolOption
&
option
,
bool
preferred_tcp
=
false
);
protected
:
...
...
@@ -51,7 +51,7 @@ protected:
float
getLossRate
(
MediaSource
&
sender
,
TrackType
type
)
override
;
private
:
WebRtcPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
Imp
::
Ptr
&
src
,
WebRtcPusher
(
const
EventPoller
::
Ptr
&
poller
,
const
RtspMediaSource
::
Ptr
&
src
,
const
std
::
shared_ptr
<
void
>
&
ownership
,
const
MediaInfo
&
info
,
const
ProtocolOption
&
option
,
bool
preferred_tcp
);
private
:
...
...
@@ -61,7 +61,7 @@ private:
//媒体相关元数据
MediaInfo
_media_info
;
//推流的rtsp源
RtspMediaSource
Imp
::
Ptr
_push_src
;
RtspMediaSource
::
Ptr
_push_src
;
//推流所有权
std
::
shared_ptr
<
void
>
_push_src_ownership
;
//推流的rtsp源,支持simulcast
...
...
webrtc/WebRtcTransport.cpp
查看文件 @
f4ee607f
...
...
@@ -23,6 +23,8 @@
#include "WebRtcPlayer.h"
#include "WebRtcPusher.h"
#include "Rtsp/RtspMediaSourceImp.h"
#define RTP_SSRC_OFFSET 1
#define RTX_SSRC_OFFSET 2
#define RTP_CNAME "zlmediakit-rtp"
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论