mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-21 01:13:37 +08:00
完善代码
This commit is contained in:
parent
affc98f927
commit
1629d1f63a
@ -49,9 +49,8 @@ public:
|
||||
* @param track 媒体描述
|
||||
*/
|
||||
void addTrack(const Track::Ptr & track) {
|
||||
//克隆track的目的是防止inputFrame时由于用的同一个track而导致写入两次数据
|
||||
_rtmp->addTrack(track->clone());
|
||||
_rtsp->addTrack(track->clone());
|
||||
_rtmp->addTrack(track);
|
||||
_rtsp->addTrack(track);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +58,6 @@ public:
|
||||
* @param frame 帧数据
|
||||
*/
|
||||
void inputFrame(const Frame::Ptr &frame) override {
|
||||
//_rtmp和_rtsp对象不能使用相同的Track,否则会触发两次inputFrame操作
|
||||
_rtmp->inputFrame(frame);
|
||||
_rtsp->inputFrame(frame);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void PlayerProxy::onPlaySuccess() {
|
||||
auto videoTrack = getTrack(TrackVideo);
|
||||
if(videoTrack){
|
||||
//添加视频
|
||||
_pChn->addTrack(videoTrack->clone());
|
||||
_pChn->addTrack(videoTrack);
|
||||
//视频数据写入_pChn
|
||||
videoTrack->addDelegate(_pChn);
|
||||
}
|
||||
@ -187,7 +187,7 @@ void PlayerProxy::onPlaySuccess() {
|
||||
auto audioTrack = getTrack(TrackAudio);
|
||||
if(audioTrack){
|
||||
//添加音频
|
||||
_pChn->addTrack(audioTrack->clone());
|
||||
_pChn->addTrack(audioTrack);
|
||||
//音频数据写入_pChn
|
||||
audioTrack->addDelegate(_pChn);
|
||||
}else if(videoTrack){
|
||||
|
@ -28,8 +28,9 @@
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
void RtmpMuxer::addTrack(const Track::Ptr &track) {
|
||||
//记录该Track
|
||||
void RtmpMuxer::addTrack(const Track::Ptr &track_in) {
|
||||
//克隆Track,只拷贝其数据,不拷贝其数据转发关系
|
||||
auto track = track_in->clone();
|
||||
auto codec_id = track->getCodecId();
|
||||
_track_map[codec_id] = track;
|
||||
|
||||
|
@ -29,7 +29,9 @@
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
void RtspMuxer::addTrack(const Track::Ptr &track, uint32_t ssrc, int mtu) {
|
||||
void RtspMuxer::addTrack(const Track::Ptr &track_in, uint32_t ssrc, int mtu) {
|
||||
//克隆Track,只拷贝其数据,不拷贝其数据转发关系
|
||||
auto track = track_in->clone();
|
||||
auto codec_id = track->getCodecId();
|
||||
_track_map[codec_id] = track;
|
||||
if(mtu == 0){
|
||||
|
Loading…
Reference in New Issue
Block a user